├── .gitignore ├── LICENSE ├── Pipfile ├── Pipfile.lock ├── README.md ├── alignment ├── align-sample.txt ├── crosslingual-cca │ ├── LICENSE │ ├── README.md │ ├── align-sample.txt │ ├── alignVectors.py │ ├── cluster_embeddings.m │ ├── cluster_embeddings.py │ ├── eval_cluster_embeddings.py │ ├── paste.py │ ├── project_vectors.m │ ├── project_vectors.sh │ ├── project_vectors_to_lang2.m │ ├── project_vectors_to_lang2.sh │ └── train-multilingual-embeddings.sh └── model_preprocessing.py ├── app ├── README.md ├── app.py └── templates │ └── index.html ├── code_embeddings ├── Function_embedder.py ├── Word_embedder.py ├── __init__.py ├── __pycache__ │ ├── Function_embedder.cpython-36.pyc │ ├── Word_embedder.cpython-36.pyc │ ├── embedding_visualizer.cpython-36.pyc │ └── rawCodeReader.cpython-36.pyc ├── cef.txt ├── doc2vec_embedder.py ├── embedding_visualizer.py ├── lda2vec_main.py ├── main.py ├── rawCodeReader.py └── utils.py ├── experiments ├── .ipynb_checkpoints │ └── doc2vec_experiments-checkpoint.ipynb ├── __init__.py ├── build_rosetta_dataset.py ├── doc2vec.py ├── doc2vec_experiments.ipynb ├── doc2vec_python_experiments.ipynb ├── file_splitting.py ├── fixtures │ ├── forest-fire.java │ ├── forest-fire.php │ ├── forest-fire.py │ └── testfile.js ├── java_parsing.ipynb ├── python_parsing.ipynb └── tokenization.py ├── output full data 5 iters 10 windowsize.txt ├── output full data 5 iters 5 windowsize keep frequent words only.txt ├── output full data 5 iters 5 windowsize.txt ├── setup.py ├── test_data ├── .keep ├── C++ │ ├── 100-doors │ │ ├── 100-doors-1.cpp │ │ ├── 100-doors-2.cpp │ │ └── 100-doors-3.cpp │ ├── 24-game │ │ └── 24-game.cpp │ ├── A+B │ │ ├── a+b-1.cpp │ │ └── a+b-2.cpp │ ├── ABC-Problem │ │ └── abc-problem.cpp │ ├── Accumulator-factory │ │ ├── accumulator-factory-1.cpp │ │ ├── accumulator-factory-2.cpp │ │ ├── accumulator-factory-3.cpp │ │ ├── accumulator-factory-4.cpp │ │ ├── accumulator-factory-5.cpp │ │ └── accumulator-factory-6.cpp │ ├── Ackermann-function │ │ ├── ackermann-function-1.cpp │ │ └── ackermann-function-2.cpp │ ├── Anagrams-Deranged-anagrams │ │ └── anagrams-deranged-anagrams.cpp │ ├── Anagrams │ │ └── anagrams.cpp │ ├── Anonymous-recursion │ │ ├── anonymous-recursion-1.cpp │ │ ├── anonymous-recursion-2.cpp │ │ └── anonymous-recursion-3.cpp │ ├── Apply-a-callback-to-an-array │ │ ├── apply-a-callback-to-an-array-1.cpp │ │ ├── apply-a-callback-to-an-array-2.cpp │ │ ├── apply-a-callback-to-an-array-3.cpp │ │ ├── apply-a-callback-to-an-array-4.cpp │ │ └── apply-a-callback-to-an-array-5.cpp │ ├── Arithmetic-Integer │ │ └── arithmetic-integer.cpp │ ├── Arithmetic-geometric-mean │ │ └── arithmetic-geometric-mean.cpp │ ├── Array-concatenation │ │ ├── array-concatenation-1.cpp │ │ ├── array-concatenation-2.cpp │ │ └── array-concatenation-3.cpp │ ├── Arrays │ │ └── arrays.cpp │ ├── Associative-array-Creation │ │ ├── associative-array-creation-1.cpp │ │ ├── associative-array-creation-10.cpp │ │ ├── associative-array-creation-2.cpp │ │ ├── associative-array-creation-3.cpp │ │ ├── associative-array-creation-4.cpp │ │ ├── associative-array-creation-5.cpp │ │ ├── associative-array-creation-6.cpp │ │ ├── associative-array-creation-7.cpp │ │ ├── associative-array-creation-8.cpp │ │ └── associative-array-creation-9.cpp │ ├── Associative-array-Iteration │ │ ├── associative-array-iteration-1.cpp │ │ └── associative-array-iteration-2.cpp │ ├── Averages-Arithmetic-mean │ │ ├── averages-arithmetic-mean-1.cpp │ │ ├── averages-arithmetic-mean-2.cpp │ │ └── averages-arithmetic-mean-3.cpp │ ├── Averages-Median │ │ └── averages-median.cpp │ ├── Averages-Mode │ │ └── averages-mode.cpp │ ├── Averages-Pythagorean-means │ │ └── averages-pythagorean-means.cpp │ ├── Averages-Root-mean-square │ │ └── averages-root-mean-square.cpp │ ├── Balanced-brackets │ │ └── balanced-brackets.cpp │ ├── Binary-digits │ │ ├── binary-digits-1.cpp │ │ ├── binary-digits-2.cpp │ │ ├── binary-digits-3.cpp │ │ ├── binary-digits-4.cpp │ │ └── binary-digits-5.cpp │ ├── Binary-search │ │ ├── binary-search-1.cpp │ │ ├── binary-search-2.cpp │ │ ├── binary-search-3.cpp │ │ ├── binary-search-4.cpp │ │ ├── binary-search-5.cpp │ │ ├── binary-search-6.cpp │ │ └── binary-search-7.cpp │ ├── Bitwise-operations │ │ └── bitwise-operations.cpp │ ├── Bulls-and-cows │ │ └── bulls-and-cows.cpp │ ├── CSV-data-manipulation │ │ └── csv-data-manipulation.cpp │ ├── CSV-to-HTML-translation │ │ ├── csv-to-html-translation-1.cpp │ │ └── csv-to-html-translation-2.cpp │ ├── Caesar-cipher │ │ ├── caesar-cipher-1.cpp │ │ └── caesar-cipher-2.cpp │ ├── Call-an-object-method │ │ └── call-an-object-method.cpp │ ├── Catalan-numbers │ │ ├── catalan-numbers-1.cpp │ │ ├── catalan-numbers-2.cpp │ │ ├── catalan-numbers-3.cpp │ │ └── catalan-numbers-4.cpp │ ├── Character-codes │ │ └── character-codes.cpp │ ├── Check-that-file-exists │ │ └── check-that-file-exists.cpp │ ├── Classes │ │ ├── classes-1.cpp │ │ ├── classes-2.cpp │ │ └── classes-3.cpp │ ├── Closures-Value-capture │ │ └── closures-value-capture.cpp │ ├── Collections │ │ ├── collections-1.cpp │ │ ├── collections-2.cpp │ │ ├── collections-3.cpp │ │ ├── collections-4.cpp │ │ ├── collections-5.cpp │ │ └── collections-6.cpp │ ├── Combinations-with-repetitions │ │ └── combinations-with-repetitions.cpp │ ├── Combinations │ │ └── combinations.cpp │ ├── Comma-quibbling │ │ └── comma-quibbling.cpp │ ├── Command-line-arguments │ │ └── command-line-arguments.cpp │ ├── Comments │ │ ├── comments-1.cpp │ │ ├── comments-2.cpp │ │ └── comments-3.cpp │ ├── Compound-data-type │ │ ├── compound-data-type-1.cpp │ │ ├── compound-data-type-2.cpp │ │ └── compound-data-type-3.cpp │ ├── Copy-a-string │ │ └── copy-a-string.cpp │ ├── Count-in-octal │ │ └── count-in-octal.cpp │ ├── Count-occurrences-of-a-substring │ │ └── count-occurrences-of-a-substring.cpp │ ├── Create-an-HTML-table │ │ ├── create-an-html-table-1.cpp │ │ └── create-an-html-table-2.cpp │ ├── Date-format │ │ └── date-format.cpp │ ├── Date-manipulation │ │ └── date-manipulation.cpp │ ├── Day-of-the-week │ │ └── day-of-the-week.cpp │ ├── Delegates │ │ └── delegates.cpp │ ├── Delete-a-file │ │ └── delete-a-file.cpp │ ├── Detect-division-by-zero │ │ └── detect-division-by-zero.cpp │ ├── Determine-if-a-string-is-numeric │ │ ├── determine-if-a-string-is-numeric-1.cpp │ │ ├── determine-if-a-string-is-numeric-2.cpp │ │ └── determine-if-a-string-is-numeric-3.cpp │ ├── Discordian-date │ │ └── discordian-date.cpp │ ├── Dot-product │ │ ├── dot-product-1.cpp │ │ └── dot-product-2.cpp │ ├── Empty-string │ │ └── empty-string.cpp │ ├── Enforced-immutability │ │ ├── enforced-immutability-1.cpp │ │ └── enforced-immutability-2.cpp │ ├── Enumerations │ │ ├── enumerations-1.cpp │ │ ├── enumerations-2.cpp │ │ ├── enumerations-3.cpp │ │ └── enumerations-4.cpp │ ├── Environment-variables │ │ └── environment-variables.cpp │ ├── Equilibrium-index │ │ └── equilibrium-index.cpp │ ├── Evaluate-binomial-coefficients │ │ ├── evaluate-binomial-coefficients-1.cpp │ │ └── evaluate-binomial-coefficients-2.cpp │ ├── Even-or-odd │ │ ├── even-or-odd-1.cpp │ │ └── even-or-odd-2.cpp │ ├── Evolutionary-algorithm │ │ └── evolutionary-algorithm.cpp │ ├── Exceptions │ │ ├── exceptions-1.cpp │ │ ├── exceptions-2.cpp │ │ ├── exceptions-3.cpp │ │ └── exceptions-4.cpp │ ├── Execute-a-system-command │ │ └── execute-a-system-command.cpp │ ├── Factorial │ │ ├── factorial-1.cpp │ │ ├── factorial-2.cpp │ │ └── factorial-3.cpp │ ├── Factors-of-an-integer │ │ └── factors-of-an-integer.cpp │ ├── Fibonacci-n-step-number-sequences │ │ ├── fibonacci-n-step-number-sequences-1.cpp │ │ └── fibonacci-n-step-number-sequences-2.cpp │ ├── Fibonacci-sequence │ │ ├── fibonacci-sequence-1.cpp │ │ ├── fibonacci-sequence-2.cpp │ │ ├── fibonacci-sequence-3.cpp │ │ ├── fibonacci-sequence-4.cpp │ │ ├── fibonacci-sequence-5.cpp │ │ ├── fibonacci-sequence-6.cpp │ │ ├── fibonacci-sequence-7.cpp │ │ └── fibonacci-sequence-8.cpp │ ├── File-input-output │ │ ├── file-input-output-1.cpp │ │ ├── file-input-output-2.cpp │ │ ├── file-input-output-3.cpp │ │ └── file-input-output-4.cpp │ ├── File-modification-time │ │ └── file-modification-time.cpp │ ├── File-size │ │ ├── file-size-1.cpp │ │ └── file-size-2.cpp │ ├── Filter │ │ ├── filter-1.cpp │ │ └── filter-2.cpp │ ├── Find-limit-of-recursion │ │ └── find-limit-of-recursion.cpp │ ├── Find-the-last-Sunday-of-each-month │ │ ├── find-the-last-sunday-of-each-month-1.cpp │ │ └── find-the-last-sunday-of-each-month-2.cpp │ ├── Find-the-missing-permutation │ │ └── find-the-missing-permutation.cpp │ ├── First-class-functions │ │ └── first-class-functions.cpp │ ├── Flatten-a-list │ │ ├── flatten-a-list-1.cpp │ │ └── flatten-a-list-2.cpp │ ├── Floyds-triangle │ │ └── floyds-triangle.cpp │ ├── Forest-fire │ │ └── forest-fire.cpp │ ├── Formatted-numeric-output │ │ └── formatted-numeric-output.cpp │ ├── Forward-difference │ │ ├── forward-difference-1.cpp │ │ ├── forward-difference-2.cpp │ │ ├── forward-difference-3.cpp │ │ └── forward-difference-4.cpp │ ├── Fractal-tree │ │ └── fractal-tree.cpp │ ├── Function-composition │ │ ├── function-composition-1.cpp │ │ ├── function-composition-2.cpp │ │ ├── function-composition-3.cpp │ │ └── function-composition-4.cpp │ ├── Function-definition │ │ ├── function-definition-1.cpp │ │ └── function-definition-2.cpp │ ├── Generate-lower-case-ASCII-alphabet │ │ └── generate-lower-case-ascii-alphabet.cpp │ ├── Generator-Exponential │ │ └── generator-exponential.cpp │ ├── Generic-swap │ │ ├── generic-swap-1.cpp │ │ ├── generic-swap-2.cpp │ │ └── generic-swap-3.cpp │ ├── Greatest-common-divisor │ │ └── greatest-common-divisor.cpp │ ├── Greatest-element-of-a-list │ │ └── greatest-element-of-a-list.cpp │ ├── Greatest-subsequential-sum │ │ └── greatest-subsequential-sum.cpp │ ├── Guess-the-number-With-feedback │ │ └── guess-the-number-with-feedback.cpp │ ├── Guess-the-number │ │ └── guess-the-number.cpp │ ├── HTTP │ │ ├── http-1.cpp │ │ └── http-2.cpp │ ├── Hailstone-sequence │ │ └── hailstone-sequence.cpp │ ├── Happy-numbers │ │ ├── happy-numbers-1.cpp │ │ └── happy-numbers-2.cpp │ ├── Hash-from-two-arrays │ │ ├── hash-from-two-arrays-1.cpp │ │ └── hash-from-two-arrays-2.cpp │ ├── Hello-world-Graphical │ │ ├── hello-world-graphical-1.cpp │ │ ├── hello-world-graphical-2.cpp │ │ └── hello-world-graphical-3.cpp │ ├── Hello-world-Line-printer │ │ └── hello-world-line-printer.cpp │ ├── Hello-world-Standard-error │ │ └── hello-world-standard-error.cpp │ ├── Hello-world-Text │ │ └── hello-world-text.cpp │ ├── Higher-order-functions │ │ ├── higher-order-functions-1.cpp │ │ └── higher-order-functions-2.cpp │ ├── Horners-rule-for-polynomial-evaluation │ │ ├── horners-rule-for-polynomial-evaluation-1.cpp │ │ └── horners-rule-for-polynomial-evaluation-2.cpp │ ├── Huffman-coding │ │ └── huffman-coding.cpp │ ├── IBAN │ │ └── iban.cpp │ ├── Identity-matrix │ │ ├── identity-matrix-1.cpp │ │ └── identity-matrix-2.cpp │ ├── Increment-a-numerical-string │ │ ├── increment-a-numerical-string-1.cpp │ │ ├── increment-a-numerical-string-2.cpp │ │ ├── increment-a-numerical-string-3.cpp │ │ ├── increment-a-numerical-string-4.cpp │ │ ├── increment-a-numerical-string-5.cpp │ │ └── increment-a-numerical-string-6.cpp │ ├── Infinity │ │ └── infinity.cpp │ ├── Inheritance-Single │ │ └── inheritance-single.cpp │ ├── Input-loop │ │ ├── input-loop-1.cpp │ │ └── input-loop-2.cpp │ ├── Integer-comparison │ │ └── integer-comparison.cpp │ ├── JSON │ │ ├── json-1.cpp │ │ └── json-2.cpp │ ├── Jensens-Device │ │ └── jensens-device.cpp │ ├── Josephus-problem │ │ └── josephus-problem.cpp │ ├── Kaprekar-numbers │ │ ├── kaprekar-numbers-1.cpp │ │ ├── kaprekar-numbers-2.cpp │ │ ├── kaprekar-numbers-3.cpp │ │ ├── kaprekar-numbers-4.cpp │ │ └── kaprekar-numbers-5.cpp │ ├── Knapsack-problem-0-1 │ │ └── knapsack-problem-0-1.cpp │ ├── Knuth-shuffle │ │ ├── knuth-shuffle-1.cpp │ │ └── knuth-shuffle-2.cpp │ ├── LZW-compression │ │ └── lzw-compression.cpp │ ├── Langtons-ant │ │ └── langtons-ant.cpp │ ├── Largest-int-from-concatenated-ints │ │ └── largest-int-from-concatenated-ints.cpp │ ├── Leap-year │ │ └── leap-year.cpp │ ├── Least-common-multiple │ │ ├── least-common-multiple-1.cpp │ │ └── least-common-multiple-2.cpp │ ├── Letter-frequency │ │ └── letter-frequency.cpp │ ├── Levenshtein-distance │ │ └── levenshtein-distance.cpp │ ├── Literals-Integer │ │ └── literals-integer.cpp │ ├── Literals-String │ │ └── literals-string.cpp │ ├── Logical-operations │ │ └── logical-operations.cpp │ ├── Long-multiplication │ │ ├── long-multiplication-1.cpp │ │ └── long-multiplication-2.cpp │ ├── Longest-increasing-subsequence │ │ └── longest-increasing-subsequence.cpp │ ├── Look-and-say-sequence │ │ └── look-and-say-sequence.cpp │ ├── Loop-over-multiple-arrays-simultaneously │ │ ├── loop-over-multiple-arrays-simultaneously-1.cpp │ │ ├── loop-over-multiple-arrays-simultaneously-2.cpp │ │ ├── loop-over-multiple-arrays-simultaneously-3.cpp │ │ ├── loop-over-multiple-arrays-simultaneously-4.cpp │ │ ├── loop-over-multiple-arrays-simultaneously-5.cpp │ │ └── loop-over-multiple-arrays-simultaneously-6.cpp │ ├── Loops-Break │ │ └── loops-break.cpp │ ├── Loops-Continue │ │ └── loops-continue.cpp │ ├── Loops-Do-while │ │ └── loops-do-while.cpp │ ├── Loops-Downward-for │ │ └── loops-downward-for.cpp │ ├── Loops-For-with-a-specified-step │ │ └── loops-for-with-a-specified-step.cpp │ ├── Loops-For │ │ └── loops-for.cpp │ ├── Loops-Foreach │ │ ├── loops-foreach-1.cpp │ │ ├── loops-foreach-2.cpp │ │ ├── loops-foreach-3.cpp │ │ ├── loops-foreach-4.cpp │ │ ├── loops-foreach-5.cpp │ │ └── loops-foreach-6.cpp │ ├── Loops-Infinite │ │ ├── loops-infinite-1.cpp │ │ ├── loops-infinite-2.cpp │ │ └── loops-infinite-3.cpp │ ├── Loops-N-plus-one-half │ │ └── loops-n-plus-one-half.cpp │ ├── Loops-Nested │ │ ├── loops-nested-1.cpp │ │ └── loops-nested-2.cpp │ ├── Loops-While │ │ ├── loops-while-1.cpp │ │ ├── loops-while-2.cpp │ │ ├── loops-while-3.cpp │ │ └── loops-while-4.cpp │ ├── Luhn-test-of-credit-card-numbers │ │ ├── luhn-test-of-credit-card-numbers-1.cpp │ │ ├── luhn-test-of-credit-card-numbers-2.cpp │ │ └── luhn-test-of-credit-card-numbers-3.cpp │ ├── Man-or-boy-test │ │ ├── man-or-boy-test-1.cpp │ │ ├── man-or-boy-test-2.cpp │ │ └── man-or-boy-test-3.cpp │ ├── Mandelbrot-set │ │ └── mandelbrot-set.cpp │ ├── Matrix-transposition │ │ ├── matrix-transposition-1.cpp │ │ ├── matrix-transposition-2.cpp │ │ ├── matrix-transposition-3.cpp │ │ └── matrix-transposition-4.cpp │ ├── Menu │ │ └── menu.cpp │ ├── Middle-three-digits │ │ └── middle-three-digits.cpp │ ├── Modular-inverse │ │ ├── modular-inverse-1.cpp │ │ └── modular-inverse-2.cpp │ ├── Monte-Carlo-methods │ │ └── monte-carlo-methods.cpp │ ├── Monty-Hall-problem │ │ └── monty-hall-problem.cpp │ ├── Mutual-recursion │ │ ├── mutual-recursion-1.cpp │ │ └── mutual-recursion-2.cpp │ ├── N-queens-problem │ │ ├── n-queens-problem-1.cpp │ │ ├── n-queens-problem-2.cpp │ │ ├── n-queens-problem-3.cpp │ │ └── n-queens-problem-4.cpp │ ├── Named-parameters │ │ ├── named-parameters-1.cpp │ │ ├── named-parameters-2.cpp │ │ ├── named-parameters-3.cpp │ │ ├── named-parameters-4.cpp │ │ └── named-parameters-5.cpp │ ├── Non-decimal-radices-Convert │ │ └── non-decimal-radices-convert.cpp │ ├── Non-decimal-radices-Input │ │ └── non-decimal-radices-input.cpp │ ├── Non-decimal-radices-Output │ │ └── non-decimal-radices-output.cpp │ ├── Nth-root │ │ ├── nth-root-1.cpp │ │ └── nth-root-2.cpp │ ├── Nth │ │ └── nth.cpp │ ├── Null-object │ │ ├── null-object-1.cpp │ │ ├── null-object-2.cpp │ │ └── null-object-3.cpp │ ├── Number-reversal-game │ │ ├── number-reversal-game-1.cpp │ │ └── number-reversal-game-2.cpp │ ├── Palindrome-detection │ │ ├── palindrome-detection-1.cpp │ │ └── palindrome-detection-2.cpp │ ├── Pangram-checker │ │ └── pangram-checker.cpp │ ├── Parsing-RPN-calculator-algorithm │ │ └── parsing-rpn-calculator-algorithm.cpp │ ├── Pascals-triangle │ │ ├── pascals-triangle-1.cpp │ │ ├── pascals-triangle-2.cpp │ │ └── pascals-triangle-3.cpp │ ├── Perfect-numbers │ │ └── perfect-numbers.cpp │ ├── Permutations │ │ └── permutations.cpp │ ├── Phrase-reversals │ │ └── phrase-reversals.cpp │ ├── Pick-random-element │ │ └── pick-random-element.cpp │ ├── Playing-cards │ │ └── playing-cards.cpp │ ├── Polymorphic-copy │ │ └── polymorphic-copy.cpp │ ├── Polymorphism │ │ ├── polymorphism-1.cpp │ │ └── polymorphism-2.cpp │ ├── Power-set │ │ ├── power-set-1.cpp │ │ ├── power-set-2.cpp │ │ └── power-set-3.cpp │ ├── Primality-by-trial-division │ │ └── primality-by-trial-division.cpp │ ├── Program-name │ │ └── program-name.cpp │ ├── Program-termination │ │ ├── program-termination-1.cpp │ │ ├── program-termination-2.cpp │ │ └── program-termination-3.cpp │ ├── Queue-Definition │ │ └── queue-definition.cpp │ ├── Quine │ │ └── quine.cpp │ ├── Random-numbers │ │ ├── random-numbers-1.cpp │ │ ├── random-numbers-2.cpp │ │ └── random-numbers-3.cpp │ ├── Range-expansion │ │ └── range-expansion.cpp │ ├── Read-a-file-line-by-line │ │ ├── read-a-file-line-by-line-1.cpp │ │ └── read-a-file-line-by-line-2.cpp │ ├── Read-entire-file │ │ └── read-entire-file.cpp │ ├── Real-constants-and-functions │ │ └── real-constants-and-functions.cpp │ ├── Reduced-row-echelon-form │ │ └── reduced-row-echelon-form.cpp │ ├── Regular-expressions │ │ └── regular-expressions.cpp │ ├── Remove-duplicate-elements │ │ ├── remove-duplicate-elements-1.cpp │ │ ├── remove-duplicate-elements-2.cpp │ │ ├── remove-duplicate-elements-3.cpp │ │ ├── remove-duplicate-elements-4.cpp │ │ └── remove-duplicate-elements-5.cpp │ ├── Rename-a-file │ │ ├── rename-a-file-1.cpp │ │ └── rename-a-file-2.cpp │ ├── Repeat-a-string │ │ ├── repeat-a-string-1.cpp │ │ └── repeat-a-string-2.cpp │ ├── Return-multiple-values │ │ └── return-multiple-values.cpp │ ├── Reverse-a-string │ │ └── reverse-a-string.cpp │ ├── Reverse-words-in-a-string │ │ ├── reverse-words-in-a-string-1.cpp │ │ └── reverse-words-in-a-string-2.cpp │ ├── Roman-numerals-Decode │ │ └── roman-numerals-decode.cpp │ ├── Roman-numerals-Encode │ │ └── roman-numerals-encode.cpp │ ├── Rot-13 │ │ ├── rot-13-1.cpp │ │ ├── rot-13-2.cpp │ │ └── rot-13-3.cpp │ ├── Run-length-encoding │ │ └── run-length-encoding.cpp │ ├── SEDOLs │ │ └── sedols.cpp │ ├── Search-a-list │ │ ├── search-a-list-1.cpp │ │ └── search-a-list-2.cpp │ ├── Self-describing-numbers │ │ ├── self-describing-numbers-1.cpp │ │ └── self-describing-numbers-2.cpp │ ├── Semordnilap │ │ └── semordnilap.cpp │ ├── Sequence-of-non-squares │ │ └── sequence-of-non-squares.cpp │ ├── Show-the-epoch │ │ ├── show-the-epoch-1.cpp │ │ └── show-the-epoch-2.cpp │ ├── Sieve-of-Eratosthenes │ │ ├── sieve-of-eratosthenes-1.cpp │ │ └── sieve-of-eratosthenes-2.cpp │ ├── Singleton │ │ └── singleton.cpp │ ├── Sleep │ │ ├── sleep-1.cpp │ │ └── sleep-2.cpp │ ├── Sort-an-integer-array │ │ ├── sort-an-integer-array-1.cpp │ │ ├── sort-an-integer-array-2.cpp │ │ └── sort-an-integer-array-3.cpp │ ├── Sort-using-a-custom-comparator │ │ └── sort-using-a-custom-comparator.cpp │ ├── Sorting-algorithms-Bogosort │ │ └── sorting-algorithms-bogosort.cpp │ ├── Sorting-algorithms-Bubble-sort │ │ └── sorting-algorithms-bubble-sort.cpp │ ├── Sorting-algorithms-Cocktail-sort │ │ ├── sorting-algorithms-cocktail-sort-1.cpp │ │ └── sorting-algorithms-cocktail-sort-2.cpp │ ├── Sorting-algorithms-Comb-sort │ │ └── sorting-algorithms-comb-sort.cpp │ ├── Sorting-algorithms-Counting-sort │ │ ├── sorting-algorithms-counting-sort-1.cpp │ │ └── sorting-algorithms-counting-sort-2.cpp │ ├── Sorting-algorithms-Gnome-sort │ │ └── sorting-algorithms-gnome-sort.cpp │ ├── Sorting-algorithms-Insertion-sort │ │ └── sorting-algorithms-insertion-sort.cpp │ ├── Sorting-algorithms-Merge-sort │ │ └── sorting-algorithms-merge-sort.cpp │ ├── Sorting-algorithms-Quicksort │ │ ├── sorting-algorithms-quicksort-1.cpp │ │ └── sorting-algorithms-quicksort-2.cpp │ ├── Sorting-algorithms-Selection-sort │ │ └── sorting-algorithms-selection-sort.cpp │ ├── Sorting-algorithms-Shell-sort │ │ └── sorting-algorithms-shell-sort.cpp │ ├── Sorting-algorithms-Stooge-sort │ │ └── sorting-algorithms-stooge-sort.cpp │ ├── Stack │ │ ├── stack-1.cpp │ │ ├── stack-2.cpp │ │ ├── stack-3.cpp │ │ └── stack-4.cpp │ ├── String-case │ │ ├── string-case-1.cpp │ │ └── string-case-2.cpp │ ├── String-concatenation │ │ └── string-concatenation.cpp │ ├── String-interpolation--included- │ │ └── string-interpolation--included-.cpp │ ├── String-length │ │ ├── string-length-1.cpp │ │ ├── string-length-2.cpp │ │ ├── string-length-3.cpp │ │ ├── string-length-4.cpp │ │ ├── string-length-5.cpp │ │ └── string-length-6.cpp │ ├── String-matching │ │ └── string-matching.cpp │ ├── Strip-a-set-of-characters-from-a-string │ │ └── strip-a-set-of-characters-from-a-string.cpp │ ├── Strip-whitespace-from-a-string-Top-and-tail │ │ └── strip-whitespace-from-a-string-top-and-tail.cpp │ ├── Substring-Top-and-tail │ │ └── substring-top-and-tail.cpp │ ├── Substring │ │ └── substring.cpp │ ├── Sudoku │ │ └── sudoku.cpp │ ├── Sum-and-product-of-an-array │ │ ├── sum-and-product-of-an-array-1.cpp │ │ └── sum-and-product-of-an-array-2.cpp │ ├── Sum-digits-of-an-integer │ │ ├── sum-digits-of-an-integer-1.cpp │ │ └── sum-digits-of-an-integer-2.cpp │ ├── Sum-of-a-series │ │ └── sum-of-a-series.cpp │ ├── Sum-of-squares │ │ ├── sum-of-squares-1.cpp │ │ └── sum-of-squares-2.cpp │ ├── Symmetric-difference │ │ └── symmetric-difference.cpp │ ├── System-time │ │ ├── system-time-1.cpp │ │ └── system-time-2.cpp │ ├── Take-notes-on-the-command-line │ │ └── take-notes-on-the-command-line.cpp │ ├── Temperature-conversion │ │ └── temperature-conversion.cpp │ ├── Ternary-logic │ │ └── ternary-logic.cpp │ ├── Text-processing-2 │ │ └── text-processing-2.cpp │ ├── Text-processing-Max-licenses-in-use │ │ └── text-processing-max-licenses-in-use.cpp │ ├── The-Twelve-Days-of-Christmas │ │ └── the-twelve-days-of-christmas.cpp │ ├── Tokenize-a-string │ │ ├── tokenize-a-string-1.cpp │ │ ├── tokenize-a-string-2.cpp │ │ └── tokenize-a-string-3.cpp │ ├── Top-rank-per-group │ │ └── top-rank-per-group.cpp │ ├── Towers-of-Hanoi │ │ └── towers-of-hanoi.cpp │ ├── Tree-traversal │ │ └── tree-traversal.cpp │ ├── Trigonometric-functions │ │ └── trigonometric-functions.cpp │ ├── URL-decoding │ │ └── url-decoding.cpp │ ├── URL-encoding │ │ └── url-encoding.cpp │ ├── Unix-ls │ │ └── unix-ls.cpp │ ├── User-input-Text │ │ ├── user-input-text-1.cpp │ │ ├── user-input-text-2.cpp │ │ └── user-input-text-3.cpp │ ├── Variadic-function │ │ └── variadic-function.cpp │ ├── Vector-products │ │ └── vector-products.cpp │ ├── Vigen-re-cipher │ │ └── vigen-re-cipher.cpp │ ├── Walk-a-directory-Non-recursively │ │ └── walk-a-directory-non-recursively.cpp │ ├── Walk-a-directory-Recursively │ │ └── walk-a-directory-recursively.cpp │ ├── Web-scraping │ │ └── web-scraping.cpp │ ├── XML-Input │ │ └── xml-input.cpp │ ├── XML-XPath │ │ └── xml-xpath.cpp │ ├── Y-combinator │ │ ├── y-combinator-1.cpp │ │ ├── y-combinator-2.cpp │ │ ├── y-combinator-3.cpp │ │ └── y-combinator-4.cpp │ ├── Zeckendorf-number-representation │ │ ├── zeckendorf-number-representation-1.cpp │ │ └── zeckendorf-number-representation-2.cpp │ ├── Zero-to-the-zero-power │ │ └── zero-to-the-zero-power.cpp │ └── Zig-zag-matrix │ │ └── zig-zag-matrix.cpp ├── Java │ ├── 100-doors │ │ ├── 100-doors-1.java │ │ ├── 100-doors-2.java │ │ └── 100-doors-3.java │ ├── 24-game │ │ └── 24-game.java │ ├── A+B │ │ ├── a+b-1.java │ │ ├── a+b-2.java │ │ ├── a+b-3.java │ │ └── a+b-4.java │ ├── ABC-Problem │ │ └── abc-problem.java │ ├── Accumulator-factory │ │ ├── accumulator-factory-1.java │ │ ├── accumulator-factory-2.java │ │ ├── accumulator-factory-3.java │ │ ├── accumulator-factory-4.java │ │ └── accumulator-factory-5.java │ ├── Ackermann-function │ │ ├── ackermann-function-1.java │ │ ├── ackermann-function-2.java │ │ ├── ackermann-function-3.java │ │ └── ackermann-function-4.java │ ├── Anagrams-Deranged-anagrams │ │ └── anagrams-deranged-anagrams.java │ ├── Anagrams │ │ ├── anagrams-1.java │ │ └── anagrams-2.java │ ├── Anonymous-recursion │ │ ├── anonymous-recursion-1.java │ │ └── anonymous-recursion-2.java │ ├── Apply-a-callback-to-an-array │ │ ├── apply-a-callback-to-an-array-1.java │ │ └── apply-a-callback-to-an-array-2.java │ ├── Arithmetic-Integer │ │ └── arithmetic-integer.java │ ├── Arithmetic-geometric-mean │ │ └── arithmetic-geometric-mean.java │ ├── Array-concatenation │ │ └── array-concatenation.java │ ├── Arrays │ │ ├── arrays-1.java │ │ └── arrays-2.java │ ├── Associative-array-Creation │ │ ├── associative-array-creation-1.java │ │ ├── associative-array-creation-2.java │ │ ├── associative-array-creation-3.java │ │ ├── associative-array-creation-4.java │ │ ├── associative-array-creation-5.java │ │ └── associative-array-creation-6.java │ ├── Associative-array-Iteration │ │ ├── associative-array-iteration-1.java │ │ └── associative-array-iteration-2.java │ ├── Averages-Arithmetic-mean │ │ └── averages-arithmetic-mean.java │ ├── Averages-Median │ │ ├── averages-median-1.java │ │ └── averages-median-2.java │ ├── Averages-Mode │ │ └── averages-mode.java │ ├── Averages-Pythagorean-means │ │ ├── averages-pythagorean-means-1.java │ │ └── averages-pythagorean-means-2.java │ ├── Averages-Root-mean-square │ │ └── averages-root-mean-square.java │ ├── Balanced-brackets │ │ └── balanced-brackets.java │ ├── Binary-digits │ │ └── binary-digits.java │ ├── Binary-search │ │ ├── binary-search-1.java │ │ ├── binary-search-2.java │ │ ├── binary-search-3.java │ │ └── binary-search-4.java │ ├── Bitwise-operations │ │ ├── bitwise-operations-1.java │ │ └── bitwise-operations-2.java │ ├── Bulls-and-cows │ │ └── bulls-and-cows.java │ ├── CSV-data-manipulation │ │ ├── csv-data-manipulation-1.java │ │ ├── csv-data-manipulation-2.java │ │ └── csv-data-manipulation-3.java │ ├── CSV-to-HTML-translation │ │ ├── csv-to-html-translation-1.java │ │ ├── csv-to-html-translation-2.java │ │ └── csv-to-html-translation-3.java │ ├── Caesar-cipher │ │ └── caesar-cipher.java │ ├── Call-an-object-method │ │ ├── call-an-object-method-1.java │ │ └── call-an-object-method-2.java │ ├── Catalan-numbers │ │ └── catalan-numbers.java │ ├── Character-codes │ │ ├── character-codes-1.java │ │ └── character-codes-2.java │ ├── Check-that-file-exists │ │ ├── check-that-file-exists-1.java │ │ ├── check-that-file-exists-2.java │ │ └── check-that-file-exists-3.java │ ├── Classes │ │ ├── classes-1.java │ │ └── classes-2.java │ ├── Closures-Value-capture │ │ ├── closures-value-capture-1.java │ │ └── closures-value-capture-2.java │ ├── Collections │ │ ├── collections-1.java │ │ ├── collections-2.java │ │ ├── collections-3.java │ │ ├── collections-4.java │ │ └── collections-5.java │ ├── Combinations-with-repetitions │ │ ├── combinations-with-repetitions-1.java │ │ └── combinations-with-repetitions-2.java │ ├── Combinations │ │ └── combinations.java │ ├── Comma-quibbling │ │ └── comma-quibbling.java │ ├── Command-line-arguments │ │ └── command-line-arguments.java │ ├── Comments │ │ ├── comments-1.java │ │ ├── comments-2.java │ │ ├── comments-3.java │ │ ├── comments-4.java │ │ ├── comments-5.java │ │ └── comments-6.java │ ├── Compound-data-type │ │ └── compound-data-type.java │ ├── Copy-a-string │ │ ├── copy-a-string-1.java │ │ └── copy-a-string-2.java │ ├── Count-in-octal │ │ └── count-in-octal.java │ ├── Count-occurrences-of-a-substring │ │ ├── count-occurrences-of-a-substring-1.java │ │ ├── count-occurrences-of-a-substring-2.java │ │ └── count-occurrences-of-a-substring-3.java │ ├── Create-an-HTML-table │ │ ├── create-an-html-table-1.java │ │ └── create-an-html-table-2.java │ ├── Date-format │ │ ├── date-format-1.java │ │ └── date-format-2.java │ ├── Date-manipulation │ │ └── date-manipulation.java │ ├── Day-of-the-week │ │ └── day-of-the-week.java │ ├── Delegates │ │ ├── delegates-1.java │ │ ├── delegates-2.java │ │ ├── delegates-3.java │ │ ├── delegates-4.java │ │ ├── delegates-5.java │ │ └── delegates-6.java │ ├── Delete-a-file │ │ └── delete-a-file.java │ ├── Detect-division-by-zero │ │ ├── detect-division-by-zero-1.java │ │ └── detect-division-by-zero-2.java │ ├── Determine-if-a-string-is-numeric │ │ ├── determine-if-a-string-is-numeric-1.java │ │ ├── determine-if-a-string-is-numeric-2.java │ │ ├── determine-if-a-string-is-numeric-3.java │ │ ├── determine-if-a-string-is-numeric-4.java │ │ └── determine-if-a-string-is-numeric-5.java │ ├── Discordian-date │ │ └── discordian-date.java │ ├── Dot-product │ │ └── dot-product.java │ ├── Empty-string │ │ └── empty-string.java │ ├── Enforced-immutability │ │ ├── enforced-immutability-1.java │ │ ├── enforced-immutability-2.java │ │ └── enforced-immutability-3.java │ ├── Enumerations │ │ ├── enumerations-1.java │ │ └── enumerations-2.java │ ├── Environment-variables │ │ └── environment-variables.java │ ├── Equilibrium-index │ │ └── equilibrium-index.java │ ├── Evaluate-binomial-coefficients │ │ ├── evaluate-binomial-coefficients-1.java │ │ ├── evaluate-binomial-coefficients-2.java │ │ └── evaluate-binomial-coefficients-3.java │ ├── Even-or-odd │ │ ├── even-or-odd-1.java │ │ ├── even-or-odd-2.java │ │ ├── even-or-odd-3.java │ │ ├── even-or-odd-4.java │ │ └── even-or-odd-5.java │ ├── Evolutionary-algorithm │ │ └── evolutionary-algorithm.java │ ├── Exceptions │ │ ├── exceptions-1.java │ │ ├── exceptions-2.java │ │ ├── exceptions-3.java │ │ └── exceptions-4.java │ ├── Execute-a-system-command │ │ ├── execute-a-system-command-1.java │ │ ├── execute-a-system-command-2.java │ │ └── execute-a-system-command-3.java │ ├── Factorial │ │ ├── factorial-1.java │ │ └── factorial-2.java │ ├── Factors-of-an-integer │ │ └── factors-of-an-integer.java │ ├── Fibonacci-n-step-number-sequences │ │ └── fibonacci-n-step-number-sequences.java │ ├── Fibonacci-sequence │ │ ├── fibonacci-sequence-1.java │ │ ├── fibonacci-sequence-2.java │ │ ├── fibonacci-sequence-3.java │ │ ├── fibonacci-sequence-4.java │ │ ├── fibonacci-sequence-5.java │ │ └── fibonacci-sequence-6.java │ ├── File-input-output │ │ ├── file-input-output-1.java │ │ ├── file-input-output-2.java │ │ ├── file-input-output-3.java │ │ ├── file-input-output-4.java │ │ └── file-input-output-5.java │ ├── File-modification-time │ │ └── file-modification-time.java │ ├── File-size │ │ └── file-size.java │ ├── Filter │ │ └── filter.java │ ├── Find-limit-of-recursion │ │ └── find-limit-of-recursion.java │ ├── Find-the-last-Sunday-of-each-month │ │ ├── find-the-last-sunday-of-each-month-1.java │ │ └── find-the-last-sunday-of-each-month-2.java │ ├── Find-the-missing-permutation │ │ ├── find-the-missing-permutation-1.java │ │ └── find-the-missing-permutation-2.java │ ├── First-class-functions │ │ ├── first-class-functions-1.java │ │ └── first-class-functions-2.java │ ├── Flatten-a-list │ │ ├── flatten-a-list-1.java │ │ ├── flatten-a-list-2.java │ │ └── flatten-a-list-3.java │ ├── Floyds-triangle │ │ └── floyds-triangle.java │ ├── Forest-fire │ │ └── forest-fire.java │ ├── Formatted-numeric-output │ │ ├── formatted-numeric-output-1.java │ │ └── formatted-numeric-output-2.java │ ├── Forward-difference │ │ └── forward-difference.java │ ├── Fractal-tree │ │ └── fractal-tree.java │ ├── Function-composition │ │ ├── function-composition-1.java │ │ ├── function-composition-2.java │ │ └── function-composition-3.java │ ├── Function-definition │ │ └── function-definition.java │ ├── Generate-lower-case-ASCII-alphabet │ │ └── generate-lower-case-ascii-alphabet.java │ ├── Generator-Exponential │ │ └── generator-exponential.java │ ├── Generic-swap │ │ └── generic-swap.java │ ├── Greatest-common-divisor │ │ ├── greatest-common-divisor-1.java │ │ ├── greatest-common-divisor-2.java │ │ ├── greatest-common-divisor-3.java │ │ ├── greatest-common-divisor-4.java │ │ ├── greatest-common-divisor-5.java │ │ └── greatest-common-divisor-6.java │ ├── Greatest-element-of-a-list │ │ ├── greatest-element-of-a-list-1.java │ │ ├── greatest-element-of-a-list-2.java │ │ └── greatest-element-of-a-list-3.java │ ├── Greatest-subsequential-sum │ │ ├── greatest-subsequential-sum-1.java │ │ └── greatest-subsequential-sum-2.java │ ├── Guess-the-number-With-feedback │ │ └── guess-the-number-with-feedback.java │ ├── Guess-the-number │ │ └── guess-the-number.java │ ├── HTTP │ │ ├── http-1.java │ │ └── http-2.java │ ├── Hailstone-sequence │ │ └── hailstone-sequence.java │ ├── Happy-numbers │ │ └── happy-numbers.java │ ├── Hash-from-two-arrays │ │ └── hash-from-two-arrays.java │ ├── Hello-world-Graphical │ │ ├── hello-world-graphical-1.java │ │ └── hello-world-graphical-2.java │ ├── Hello-world-Line-printer │ │ └── hello-world-line-printer.java │ ├── Hello-world-Standard-error │ │ └── hello-world-standard-error.java │ ├── Hello-world-Text │ │ └── hello-world-text.java │ ├── Higher-order-functions │ │ ├── higher-order-functions-1.java │ │ └── higher-order-functions-2.java │ ├── Horners-rule-for-polynomial-evaluation │ │ └── horners-rule-for-polynomial-evaluation.java │ ├── Huffman-coding │ │ └── huffman-coding.java │ ├── IBAN │ │ └── iban.java │ ├── Identity-matrix │ │ └── identity-matrix.java │ ├── Increment-a-numerical-string │ │ ├── increment-a-numerical-string-1.java │ │ └── increment-a-numerical-string-2.java │ ├── Infinity │ │ ├── infinity-1.java │ │ ├── infinity-2.java │ │ └── infinity-3.java │ ├── Inheritance-Single │ │ ├── inheritance-single-1.java │ │ ├── inheritance-single-2.java │ │ ├── inheritance-single-3.java │ │ ├── inheritance-single-4.java │ │ └── inheritance-single-5.java │ ├── Input-loop │ │ ├── input-loop-1.java │ │ └── input-loop-2.java │ ├── Integer-comparison │ │ └── integer-comparison.java │ ├── JSON │ │ └── json.java │ ├── Jensens-Device │ │ ├── jensens-device-1.java │ │ └── jensens-device-2.java │ ├── Josephus-problem │ │ ├── josephus-problem-1.java │ │ └── josephus-problem-2.java │ ├── Kaprekar-numbers │ │ └── kaprekar-numbers.java │ ├── Knapsack-problem-0-1 │ │ ├── knapsack-problem-0-1-1.java │ │ ├── knapsack-problem-0-1-2.java │ │ └── knapsack-problem-0-1-3.java │ ├── Knuth-shuffle │ │ └── knuth-shuffle.java │ ├── LZW-compression │ │ ├── lzw-compression-1.java │ │ └── lzw-compression-2.java │ ├── Langtons-ant │ │ └── langtons-ant.java │ ├── Largest-int-from-concatenated-ints │ │ ├── largest-int-from-concatenated-ints-1.java │ │ └── largest-int-from-concatenated-ints-2.java │ ├── Leap-year │ │ └── leap-year.java │ ├── Least-common-multiple │ │ └── least-common-multiple.java │ ├── Letter-frequency │ │ ├── letter-frequency-1.java │ │ ├── letter-frequency-2.java │ │ └── letter-frequency-3.java │ ├── Levenshtein-distance │ │ ├── levenshtein-distance-1.java │ │ └── levenshtein-distance-2.java │ ├── Literals-Integer │ │ ├── literals-integer-1.java │ │ └── literals-integer-2.java │ ├── Literals-String │ │ └── literals-string.java │ ├── Logical-operations │ │ └── logical-operations.java │ ├── Long-multiplication │ │ ├── long-multiplication-1.java │ │ └── long-multiplication-2.java │ ├── Longest-increasing-subsequence │ │ └── longest-increasing-subsequence.java │ ├── Look-and-say-sequence │ │ ├── look-and-say-sequence-1.java │ │ └── look-and-say-sequence-2.java │ ├── Loop-over-multiple-arrays-simultaneously │ │ └── loop-over-multiple-arrays-simultaneously.java │ ├── Loops-Break │ │ └── loops-break.java │ ├── Loops-Continue │ │ └── loops-continue.java │ ├── Loops-Do-while │ │ └── loops-do-while.java │ ├── Loops-Downward-for │ │ └── loops-downward-for.java │ ├── Loops-For-with-a-specified-step │ │ └── loops-for-with-a-specified-step.java │ ├── Loops-For │ │ └── loops-for.java │ ├── Loops-Foreach │ │ └── loops-foreach.java │ ├── Loops-Infinite │ │ ├── loops-infinite-1.java │ │ └── loops-infinite-2.java │ ├── Loops-N-plus-one-half │ │ └── loops-n-plus-one-half.java │ ├── Loops-Nested │ │ └── loops-nested.java │ ├── Loops-While │ │ ├── loops-while-1.java │ │ └── loops-while-2.java │ ├── Luhn-test-of-credit-card-numbers │ │ └── luhn-test-of-credit-card-numbers.java │ ├── Man-or-boy-test │ │ ├── man-or-boy-test-1.java │ │ └── man-or-boy-test-2.java │ ├── Mandelbrot-set │ │ └── mandelbrot-set.java │ ├── Matrix-transposition │ │ └── matrix-transposition.java │ ├── Menu │ │ └── menu.java │ ├── Middle-three-digits │ │ └── middle-three-digits.java │ ├── Modular-inverse │ │ └── modular-inverse.java │ ├── Monte-Carlo-methods │ │ ├── monte-carlo-methods-1.java │ │ └── monte-carlo-methods-2.java │ ├── Monty-Hall-problem │ │ └── monty-hall-problem.java │ ├── Mutual-recursion │ │ └── mutual-recursion.java │ ├── N-queens-problem │ │ └── n-queens-problem.java │ ├── Named-parameters │ │ └── named-parameters.java │ ├── Non-decimal-radices-Convert │ │ ├── non-decimal-radices-convert-1.java │ │ └── non-decimal-radices-convert-2.java │ ├── Non-decimal-radices-Input │ │ ├── non-decimal-radices-input-1.java │ │ ├── non-decimal-radices-input-2.java │ │ └── non-decimal-radices-input-3.java │ ├── Non-decimal-radices-Output │ │ └── non-decimal-radices-output.java │ ├── Nth-root │ │ ├── nth-root-1.java │ │ └── nth-root-2.java │ ├── Nth │ │ ├── nth-1.java │ │ └── nth-2.java │ ├── Null-object │ │ └── null-object.java │ ├── Number-reversal-game │ │ └── number-reversal-game.java │ ├── Palindrome-detection │ │ ├── palindrome-detection-1.java │ │ ├── palindrome-detection-2.java │ │ ├── palindrome-detection-3.java │ │ └── palindrome-detection-4.java │ ├── Pangram-checker │ │ └── pangram-checker.java │ ├── Parsing-RPN-calculator-algorithm │ │ └── parsing-rpn-calculator-algorithm.java │ ├── Pascals-triangle │ │ ├── pascals-triangle-1.java │ │ ├── pascals-triangle-2.java │ │ └── pascals-triangle-3.java │ ├── Perfect-numbers │ │ ├── perfect-numbers-1.java │ │ └── perfect-numbers-2.java │ ├── Permutations │ │ ├── permutations-1.java │ │ └── permutations-2.java │ ├── Phrase-reversals │ │ └── phrase-reversals.java │ ├── Pick-random-element │ │ └── pick-random-element.java │ ├── Playing-cards │ │ ├── playing-cards-1.java │ │ ├── playing-cards-2.java │ │ ├── playing-cards-3.java │ │ └── playing-cards-4.java │ ├── Polymorphic-copy │ │ └── polymorphic-copy.java │ ├── Polymorphism │ │ └── polymorphism.java │ ├── Power-set │ │ ├── power-set-1.java │ │ ├── power-set-2.java │ │ └── power-set-3.java │ ├── Primality-by-trial-division │ │ ├── primality-by-trial-division-1.java │ │ └── primality-by-trial-division-2.java │ ├── Program-name │ │ ├── program-name-1.java │ │ ├── program-name-2.java │ │ ├── program-name-3.java │ │ └── program-name-4.java │ ├── Program-termination │ │ ├── program-termination-1.java │ │ └── program-termination-2.java │ ├── Queue-Definition │ │ └── queue-definition.java │ ├── Quine │ │ ├── quine-1.java │ │ └── quine-2.java │ ├── Random-numbers │ │ └── random-numbers.java │ ├── Range-expansion │ │ └── range-expansion.java │ ├── Read-a-file-line-by-line │ │ ├── read-a-file-line-by-line-1.java │ │ ├── read-a-file-line-by-line-2.java │ │ └── read-a-file-line-by-line-3.java │ ├── Read-entire-file │ │ ├── read-entire-file-1.java │ │ ├── read-entire-file-2.java │ │ ├── read-entire-file-3.java │ │ └── read-entire-file-4.java │ ├── Real-constants-and-functions │ │ └── real-constants-and-functions.java │ ├── Reduced-row-echelon-form │ │ └── reduced-row-echelon-form.java │ ├── Regular-expressions │ │ ├── regular-expressions-1.java │ │ ├── regular-expressions-2.java │ │ └── regular-expressions-3.java │ ├── Remove-duplicate-elements │ │ ├── remove-duplicate-elements-1.java │ │ └── remove-duplicate-elements-2.java │ ├── Rename-a-file │ │ └── rename-a-file.java │ ├── Repeat-a-string │ │ ├── repeat-a-string-1.java │ │ └── repeat-a-string-2.java │ ├── Return-multiple-values │ │ ├── return-multiple-values-1.java │ │ └── return-multiple-values-2.java │ ├── Reverse-a-string │ │ ├── reverse-a-string-1.java │ │ └── reverse-a-string-2.java │ ├── Reverse-words-in-a-string │ │ ├── reverse-words-in-a-string-1.java │ │ └── reverse-words-in-a-string-2.java │ ├── Roman-numerals-Decode │ │ ├── roman-numerals-decode-1.java │ │ └── roman-numerals-decode-2.java │ ├── Roman-numerals-Encode │ │ ├── roman-numerals-encode-1.java │ │ └── roman-numerals-encode-2.java │ ├── Rot-13 │ │ └── rot-13.java │ ├── Run-length-encoding │ │ ├── run-length-encoding-1.java │ │ └── run-length-encoding-2.java │ ├── SEDOLs │ │ └── sedols.java │ ├── Search-a-list │ │ ├── search-a-list-1.java │ │ └── search-a-list-2.java │ ├── Self-describing-numbers │ │ └── self-describing-numbers.java │ ├── Semordnilap │ │ └── semordnilap.java │ ├── Sequence-of-non-squares │ │ └── sequence-of-non-squares.java │ ├── Show-the-epoch │ │ └── show-the-epoch.java │ ├── Sieve-of-Eratosthenes │ │ ├── sieve-of-eratosthenes-1.java │ │ ├── sieve-of-eratosthenes-2.java │ │ ├── sieve-of-eratosthenes-3.java │ │ ├── sieve-of-eratosthenes-4.java │ │ ├── sieve-of-eratosthenes-5.java │ │ └── sieve-of-eratosthenes-6.java │ ├── Singleton │ │ ├── singleton-1.java │ │ ├── singleton-2.java │ │ └── singleton-3.java │ ├── Sleep │ │ └── sleep.java │ ├── Sort-an-integer-array │ │ ├── sort-an-integer-array-1.java │ │ └── sort-an-integer-array-2.java │ ├── Sort-using-a-custom-comparator │ │ ├── sort-using-a-custom-comparator-1.java │ │ └── sort-using-a-custom-comparator-2.java │ ├── Sorting-algorithms-Bogosort │ │ ├── sorting-algorithms-bogosort-1.java │ │ └── sorting-algorithms-bogosort-2.java │ ├── Sorting-algorithms-Bubble-sort │ │ ├── sorting-algorithms-bubble-sort-1.java │ │ └── sorting-algorithms-bubble-sort-2.java │ ├── Sorting-algorithms-Cocktail-sort │ │ └── sorting-algorithms-cocktail-sort.java │ ├── Sorting-algorithms-Comb-sort │ │ └── sorting-algorithms-comb-sort.java │ ├── Sorting-algorithms-Counting-sort │ │ └── sorting-algorithms-counting-sort.java │ ├── Sorting-algorithms-Gnome-sort │ │ └── sorting-algorithms-gnome-sort.java │ ├── Sorting-algorithms-Insertion-sort │ │ ├── sorting-algorithms-insertion-sort-1.java │ │ └── sorting-algorithms-insertion-sort-2.java │ ├── Sorting-algorithms-Merge-sort │ │ └── sorting-algorithms-merge-sort.java │ ├── Sorting-algorithms-Quicksort │ │ └── sorting-algorithms-quicksort.java │ ├── Sorting-algorithms-Selection-sort │ │ └── sorting-algorithms-selection-sort.java │ ├── Sorting-algorithms-Shell-sort │ │ └── sorting-algorithms-shell-sort.java │ ├── Sorting-algorithms-Stooge-sort │ │ └── sorting-algorithms-stooge-sort.java │ ├── Stack │ │ ├── stack-1.java │ │ ├── stack-2.java │ │ └── stack-3.java │ ├── String-case │ │ └── string-case.java │ ├── String-concatenation │ │ └── string-concatenation.java │ ├── String-interpolation--included- │ │ └── string-interpolation--included-.java │ ├── String-length │ │ ├── string-length-1.java │ │ ├── string-length-2.java │ │ ├── string-length-3.java │ │ └── string-length-4.java │ ├── String-matching │ │ └── string-matching.java │ ├── Strip-a-set-of-characters-from-a-string │ │ └── strip-a-set-of-characters-from-a-string.java │ ├── Strip-whitespace-from-a-string-Top-and-tail │ │ └── strip-whitespace-from-a-string-top-and-tail.java │ ├── Substring-Top-and-tail │ │ └── substring-top-and-tail.java │ ├── Substring │ │ └── substring.java │ ├── Sudoku │ │ └── sudoku.java │ ├── Sum-and-product-of-an-array │ │ ├── sum-and-product-of-an-array-1.java │ │ └── sum-and-product-of-an-array-2.java │ ├── Sum-digits-of-an-integer │ │ └── sum-digits-of-an-integer.java │ ├── Sum-of-a-series │ │ └── sum-of-a-series.java │ ├── Sum-of-squares │ │ └── sum-of-squares.java │ ├── Symmetric-difference │ │ └── symmetric-difference.java │ ├── System-time │ │ ├── system-time-1.java │ │ └── system-time-2.java │ ├── Take-notes-on-the-command-line │ │ └── take-notes-on-the-command-line.java │ ├── Temperature-conversion │ │ └── temperature-conversion.java │ ├── Ternary-logic │ │ └── ternary-logic.java │ ├── Text-processing-2 │ │ └── text-processing-2.java │ ├── Text-processing-Max-licenses-in-use │ │ └── text-processing-max-licenses-in-use.java │ ├── The-Twelve-Days-of-Christmas │ │ └── the-twelve-days-of-christmas.java │ ├── Tokenize-a-string │ │ ├── tokenize-a-string-1.java │ │ ├── tokenize-a-string-2.java │ │ └── tokenize-a-string-3.java │ ├── Top-rank-per-group │ │ └── top-rank-per-group.java │ ├── Towers-of-Hanoi │ │ └── towers-of-hanoi.java │ ├── Tree-traversal │ │ └── tree-traversal.java │ ├── Trigonometric-functions │ │ └── trigonometric-functions.java │ ├── URL-decoding │ │ └── url-decoding.java │ ├── URL-encoding │ │ └── url-encoding.java │ ├── Unix-ls │ │ └── unix-ls.java │ ├── User-input-Text │ │ ├── user-input-text-1.java │ │ └── user-input-text-2.java │ ├── Variadic-function │ │ ├── variadic-function-1.java │ │ ├── variadic-function-2.java │ │ ├── variadic-function-3.java │ │ ├── variadic-function-4.java │ │ └── variadic-function-5.java │ ├── Vector-products │ │ ├── vector-products-1.java │ │ └── vector-products-2.java │ ├── Vigen-re-cipher │ │ └── vigen-re-cipher.java │ ├── Walk-a-directory-Non-recursively │ │ └── walk-a-directory-non-recursively.java │ ├── Walk-a-directory-Recursively │ │ ├── walk-a-directory-recursively-1.java │ │ ├── walk-a-directory-recursively-2.java │ │ └── walk-a-directory-recursively-3.java │ ├── Web-scraping │ │ └── web-scraping.java │ ├── XML-Input │ │ └── xml-input.java │ ├── XML-XPath │ │ └── xml-xpath.java │ ├── Y-combinator │ │ ├── y-combinator-1.java │ │ ├── y-combinator-2.java │ │ ├── y-combinator-3.java │ │ ├── y-combinator-4.java │ │ ├── y-combinator-5.java │ │ ├── y-combinator-6.java │ │ ├── y-combinator-7.java │ │ ├── y-combinator-8.java │ │ └── y-combinator-9.java │ ├── Zeckendorf-number-representation │ │ ├── zeckendorf-number-representation-1.java │ │ └── zeckendorf-number-representation-2.java │ ├── Zero-to-the-zero-power │ │ └── zero-to-the-zero-power.java │ └── Zig-zag-matrix │ │ └── zig-zag-matrix.java ├── JavaScript │ ├── 100-doors │ │ ├── 100-doors-1.js │ │ ├── 100-doors-10.js │ │ ├── 100-doors-11.js │ │ ├── 100-doors-12.js │ │ ├── 100-doors-2.js │ │ ├── 100-doors-3.js │ │ ├── 100-doors-4.js │ │ ├── 100-doors-5.js │ │ ├── 100-doors-6.js │ │ ├── 100-doors-7.js │ │ ├── 100-doors-8.js │ │ └── 100-doors-9.js │ ├── 24-game │ │ └── 24-game.js │ ├── A+B │ │ ├── a+b-1.js │ │ ├── a+b-2.js │ │ ├── a+b-3.js │ │ └── a+b-4.js │ ├── ABC-Problem │ │ ├── abc-problem-1.js │ │ ├── abc-problem-2.js │ │ ├── abc-problem-3.js │ │ ├── abc-problem-4.js │ │ └── abc-problem-5.js │ ├── Accumulator-factory │ │ ├── accumulator-factory-1.js │ │ ├── accumulator-factory-2.js │ │ └── accumulator-factory-3.js │ ├── Ackermann-function │ │ └── ackermann-function.js │ ├── Anagrams-Deranged-anagrams │ │ ├── anagrams-deranged-anagrams-1.js │ │ └── anagrams-deranged-anagrams-2.js │ ├── Anagrams │ │ ├── anagrams-1.js │ │ └── anagrams-2.js │ ├── Anonymous-recursion │ │ ├── anonymous-recursion-1.js │ │ └── anonymous-recursion-2.js │ ├── Apply-a-callback-to-an-array │ │ ├── apply-a-callback-to-an-array-1.js │ │ ├── apply-a-callback-to-an-array-2.js │ │ └── apply-a-callback-to-an-array-3.js │ ├── Arithmetic-Integer │ │ └── arithmetic-integer.js │ ├── Arithmetic-geometric-mean │ │ ├── arithmetic-geometric-mean-1.js │ │ ├── arithmetic-geometric-mean-2.js │ │ └── arithmetic-geometric-mean-3.js │ ├── Array-concatenation │ │ ├── array-concatenation-1.js │ │ └── array-concatenation-2.js │ ├── Arrays │ │ └── arrays.js │ ├── Associative-array-Creation │ │ ├── associative-array-creation-1.js │ │ └── associative-array-creation-2.js │ ├── Associative-array-Iteration │ │ └── associative-array-iteration.js │ ├── Averages-Arithmetic-mean │ │ ├── averages-arithmetic-mean-1.js │ │ ├── averages-arithmetic-mean-2.js │ │ ├── averages-arithmetic-mean-3.js │ │ ├── averages-arithmetic-mean-4.js │ │ ├── averages-arithmetic-mean-5.js │ │ ├── averages-arithmetic-mean-6.js │ │ └── averages-arithmetic-mean-7.js │ ├── Averages-Median │ │ ├── averages-median-1.js │ │ ├── averages-median-2.js │ │ └── averages-median-3.js │ ├── Averages-Mode │ │ └── averages-mode.js │ ├── Averages-Pythagorean-means │ │ ├── averages-pythagorean-means-1.js │ │ ├── averages-pythagorean-means-2.js │ │ ├── averages-pythagorean-means-3.js │ │ └── averages-pythagorean-means-4.js │ ├── Averages-Root-mean-square │ │ ├── averages-root-mean-square-1.js │ │ └── averages-root-mean-square-2.js │ ├── Balanced-brackets │ │ ├── balanced-brackets-1.js │ │ └── balanced-brackets-2.js │ ├── Binary-digits │ │ ├── binary-digits-1.js │ │ ├── binary-digits-2.js │ │ └── binary-digits-3.js │ ├── Binary-search │ │ ├── binary-search-1.js │ │ └── binary-search-2.js │ ├── Bitwise-operations │ │ └── bitwise-operations.js │ ├── Bulls-and-cows │ │ └── bulls-and-cows.js │ ├── CSV-data-manipulation │ │ ├── csv-data-manipulation-1.js │ │ └── csv-data-manipulation-2.js │ ├── CSV-to-HTML-translation │ │ ├── csv-to-html-translation-1.js │ │ ├── csv-to-html-translation-2.js │ │ └── csv-to-html-translation-3.js │ ├── Caesar-cipher │ │ ├── caesar-cipher-1.js │ │ ├── caesar-cipher-2.js │ │ └── caesar-cipher-3.js │ ├── Call-an-object-method │ │ └── call-an-object-method.js │ ├── Catalan-numbers │ │ └── catalan-numbers.js │ ├── Character-codes │ │ ├── character-codes-1.js │ │ ├── character-codes-2.js │ │ ├── character-codes-3.js │ │ ├── character-codes-4.js │ │ └── character-codes-5.js │ ├── Check-that-file-exists │ │ ├── check-that-file-exists-1.js │ │ └── check-that-file-exists-2.js │ ├── Classes │ │ ├── classes-1.js │ │ └── classes-2.js │ ├── Closures-Value-capture │ │ ├── closures-value-capture-1.js │ │ ├── closures-value-capture-2.js │ │ ├── closures-value-capture-3.js │ │ ├── closures-value-capture-4.js │ │ └── closures-value-capture-5.js │ ├── Collections │ │ ├── collections-1.js │ │ └── collections-2.js │ ├── Combinations-with-repetitions │ │ ├── combinations-with-repetitions-1.js │ │ ├── combinations-with-repetitions-2.js │ │ ├── combinations-with-repetitions-3.js │ │ └── combinations-with-repetitions-4.js │ ├── Combinations │ │ ├── combinations-1.js │ │ ├── combinations-2.js │ │ ├── combinations-3.js │ │ ├── combinations-4.js │ │ ├── combinations-5.js │ │ ├── combinations-6.js │ │ └── combinations-7.js │ ├── Comma-quibbling │ │ ├── comma-quibbling-1.js │ │ └── comma-quibbling-2.js │ ├── Command-line-arguments │ │ ├── command-line-arguments-1.js │ │ ├── command-line-arguments-2.js │ │ └── command-line-arguments-3.js │ ├── Comments │ │ ├── comments-1.js │ │ ├── comments-2.js │ │ └── comments-3.js │ ├── Compound-data-type │ │ └── compound-data-type.js │ ├── Copy-a-string │ │ ├── copy-a-string-1.js │ │ └── copy-a-string-2.js │ ├── Count-in-octal │ │ └── count-in-octal.js │ ├── Count-occurrences-of-a-substring │ │ ├── count-occurrences-of-a-substring-1.js │ │ └── count-occurrences-of-a-substring-2.js │ ├── Create-an-HTML-table │ │ ├── create-an-html-table-1.js │ │ └── create-an-html-table-2.js │ ├── Date-format │ │ └── date-format.js │ ├── Date-manipulation │ │ └── date-manipulation.js │ ├── Day-of-the-week │ │ ├── day-of-the-week-1.js │ │ ├── day-of-the-week-2.js │ │ ├── day-of-the-week-3.js │ │ └── day-of-the-week-4.js │ ├── Delegates │ │ └── delegates.js │ ├── Delete-a-file │ │ ├── delete-a-file-1.js │ │ ├── delete-a-file-2.js │ │ ├── delete-a-file-3.js │ │ └── delete-a-file-4.js │ ├── Detect-division-by-zero │ │ └── detect-division-by-zero.js │ ├── Determine-if-a-string-is-numeric │ │ └── determine-if-a-string-is-numeric.js │ ├── Discordian-date │ │ ├── discordian-date-1.js │ │ └── discordian-date-2.js │ ├── Dot-product │ │ ├── dot-product-1.js │ │ ├── dot-product-2.js │ │ ├── dot-product-3.js │ │ └── dot-product-4.js │ ├── Empty-string │ │ ├── empty-string-1.js │ │ ├── empty-string-2.js │ │ └── empty-string-3.js │ ├── Enforced-immutability │ │ └── enforced-immutability.js │ ├── Enumerations │ │ └── enumerations.js │ ├── Environment-variables │ │ └── environment-variables.js │ ├── Equilibrium-index │ │ ├── equilibrium-index-1.js │ │ ├── equilibrium-index-2.js │ │ └── equilibrium-index-3.js │ ├── Evaluate-binomial-coefficients │ │ └── evaluate-binomial-coefficients.js │ ├── Even-or-odd │ │ ├── even-or-odd-1.js │ │ ├── even-or-odd-2.js │ │ ├── even-or-odd-3.js │ │ └── even-or-odd-4.js │ ├── Evolutionary-algorithm │ │ └── evolutionary-algorithm.js │ ├── Exceptions │ │ ├── exceptions-1.js │ │ └── exceptions-2.js │ ├── Execute-a-system-command │ │ ├── execute-a-system-command-1.js │ │ └── execute-a-system-command-2.js │ ├── Factorial │ │ ├── factorial-1.js │ │ ├── factorial-2.js │ │ ├── factorial-3.js │ │ ├── factorial-4.js │ │ ├── factorial-5.js │ │ ├── factorial-6.js │ │ └── factorial-7.js │ ├── Factors-of-an-integer │ │ ├── factors-of-an-integer-1.js │ │ ├── factors-of-an-integer-2.js │ │ ├── factors-of-an-integer-3.js │ │ ├── factors-of-an-integer-4.js │ │ ├── factors-of-an-integer-5.js │ │ └── factors-of-an-integer-6.js │ ├── Fibonacci-n-step-number-sequences │ │ └── fibonacci-n-step-number-sequences.js │ ├── Fibonacci-sequence │ │ ├── fibonacci-sequence-1.js │ │ ├── fibonacci-sequence-10.js │ │ ├── fibonacci-sequence-2.js │ │ ├── fibonacci-sequence-3.js │ │ ├── fibonacci-sequence-4.js │ │ ├── fibonacci-sequence-5.js │ │ ├── fibonacci-sequence-6.js │ │ ├── fibonacci-sequence-7.js │ │ ├── fibonacci-sequence-8.js │ │ └── fibonacci-sequence-9.js │ ├── File-input-output │ │ ├── file-input-output-1.js │ │ └── file-input-output-2.js │ ├── File-modification-time │ │ ├── file-modification-time-1.js │ │ └── file-modification-time-2.js │ ├── File-size │ │ ├── file-size-1.js │ │ └── file-size-2.js │ ├── Filter │ │ ├── filter-1.js │ │ ├── filter-2.js │ │ ├── filter-3.js │ │ ├── filter-4.js │ │ ├── filter-5.js │ │ └── filter-6.js │ ├── Find-limit-of-recursion │ │ └── find-limit-of-recursion.js │ ├── Find-the-last-Sunday-of-each-month │ │ ├── find-the-last-sunday-of-each-month-1.js │ │ ├── find-the-last-sunday-of-each-month-2.js │ │ └── find-the-last-sunday-of-each-month-3.js │ ├── Find-the-missing-permutation │ │ ├── find-the-missing-permutation-1.js │ │ ├── find-the-missing-permutation-2.js │ │ ├── find-the-missing-permutation-3.js │ │ ├── find-the-missing-permutation-4.js │ │ └── find-the-missing-permutation-5.js │ ├── First-class-functions │ │ ├── first-class-functions-1.js │ │ └── first-class-functions-2.js │ ├── Flatten-a-list │ │ ├── flatten-a-list-1.js │ │ ├── flatten-a-list-2.js │ │ ├── flatten-a-list-3.js │ │ ├── flatten-a-list-4.js │ │ ├── flatten-a-list-5.js │ │ └── flatten-a-list-6.js │ ├── Floyds-triangle │ │ ├── floyds-triangle-1.js │ │ ├── floyds-triangle-2.js │ │ └── floyds-triangle-3.js │ ├── Forest-fire │ │ ├── forest-fire-1.js │ │ └── forest-fire-2.js │ ├── Formatted-numeric-output │ │ └── formatted-numeric-output.js │ ├── Forward-difference │ │ └── forward-difference.js │ ├── Fractal-tree │ │ └── fractal-tree.js │ ├── Function-composition │ │ ├── function-composition-1.js │ │ ├── function-composition-2.js │ │ ├── function-composition-3.js │ │ ├── function-composition-4.js │ │ └── function-composition-5.js │ ├── Function-definition │ │ ├── function-definition-1.js │ │ ├── function-definition-2.js │ │ ├── function-definition-3.js │ │ ├── function-definition-4.js │ │ ├── function-definition-5.js │ │ ├── function-definition-6.js │ │ ├── function-definition-7.js │ │ └── function-definition-8.js │ ├── Generate-lower-case-ASCII-alphabet │ │ ├── generate-lower-case-ascii-alphabet-1.js │ │ ├── generate-lower-case-ascii-alphabet-2.js │ │ ├── generate-lower-case-ascii-alphabet-3.js │ │ ├── generate-lower-case-ascii-alphabet-4.js │ │ ├── generate-lower-case-ascii-alphabet-5.js │ │ └── generate-lower-case-ascii-alphabet-6.js │ ├── Generator-Exponential │ │ ├── generator-exponential-1.js │ │ ├── generator-exponential-2.js │ │ └── generator-exponential-3.js │ ├── Generic-swap │ │ ├── generic-swap-1.js │ │ └── generic-swap-2.js │ ├── Greatest-common-divisor │ │ ├── greatest-common-divisor-1.js │ │ ├── greatest-common-divisor-2.js │ │ └── greatest-common-divisor-3.js │ ├── Greatest-element-of-a-list │ │ ├── greatest-element-of-a-list-1.js │ │ ├── greatest-element-of-a-list-2.js │ │ ├── greatest-element-of-a-list-3.js │ │ ├── greatest-element-of-a-list-4.js │ │ └── greatest-element-of-a-list-5.js │ ├── Greatest-subsequential-sum │ │ └── greatest-subsequential-sum.js │ ├── Guess-the-number-With-feedback │ │ ├── guess-the-number-with-feedback-1.js │ │ ├── guess-the-number-with-feedback-2.js │ │ ├── guess-the-number-with-feedback-3.js │ │ └── guess-the-number-with-feedback-4.js │ ├── Guess-the-number │ │ └── guess-the-number.js │ ├── HTTP │ │ ├── http-1.js │ │ └── http-2.js │ ├── Hailstone-sequence │ │ ├── hailstone-sequence-1.js │ │ ├── hailstone-sequence-2.js │ │ ├── hailstone-sequence-3.js │ │ ├── hailstone-sequence-4.js │ │ ├── hailstone-sequence-5.js │ │ ├── hailstone-sequence-6.js │ │ ├── hailstone-sequence-7.js │ │ ├── hailstone-sequence-8.js │ │ └── hailstone-sequence-9.js │ ├── Happy-numbers │ │ ├── happy-numbers-1.js │ │ ├── happy-numbers-2.js │ │ ├── happy-numbers-3.js │ │ ├── happy-numbers-4.js │ │ └── happy-numbers-5.js │ ├── Hash-from-two-arrays │ │ ├── hash-from-two-arrays-1.js │ │ ├── hash-from-two-arrays-2.js │ │ └── hash-from-two-arrays-3.js │ ├── Hello-world-Graphical │ │ └── hello-world-graphical.js │ ├── Hello-world-Line-printer │ │ ├── hello-world-line-printer-1.js │ │ └── hello-world-line-printer-2.js │ ├── Hello-world-Standard-error │ │ ├── hello-world-standard-error-1.js │ │ ├── hello-world-standard-error-2.js │ │ ├── hello-world-standard-error-3.js │ │ └── hello-world-standard-error-4.js │ ├── Hello-world-Text │ │ ├── hello-world-text-1.js │ │ ├── hello-world-text-2.js │ │ ├── hello-world-text-3.js │ │ └── hello-world-text-4.js │ ├── Higher-order-functions │ │ ├── higher-order-functions-1.js │ │ └── higher-order-functions-2.js │ ├── Horners-rule-for-polynomial-evaluation │ │ └── horners-rule-for-polynomial-evaluation.js │ ├── Huffman-coding │ │ ├── huffman-coding-1.js │ │ └── huffman-coding-2.js │ ├── IBAN │ │ └── iban.js │ ├── Identity-matrix │ │ ├── identity-matrix-1.js │ │ └── identity-matrix-2.js │ ├── Increment-a-numerical-string │ │ ├── increment-a-numerical-string-1.js │ │ └── increment-a-numerical-string-2.js │ ├── Infinity │ │ ├── infinity-1.js │ │ ├── infinity-2.js │ │ └── infinity-3.js │ ├── Inheritance-Single │ │ ├── inheritance-single-1.js │ │ ├── inheritance-single-2.js │ │ ├── inheritance-single-3.js │ │ ├── inheritance-single-4.js │ │ ├── inheritance-single-5.js │ │ └── inheritance-single-6.js │ ├── Input-loop │ │ └── input-loop.js │ ├── Integer-comparison │ │ └── integer-comparison.js │ ├── JSON │ │ └── json.js │ ├── Jensens-Device │ │ └── jensens-device.js │ ├── Josephus-problem │ │ ├── josephus-problem-1.js │ │ └── josephus-problem-2.js │ ├── Kaprekar-numbers │ │ ├── kaprekar-numbers-1.js │ │ ├── kaprekar-numbers-2.js │ │ └── kaprekar-numbers-3.js │ ├── Knapsack-problem-0-1 │ │ └── knapsack-problem-0-1.js │ ├── Knuth-shuffle │ │ ├── knuth-shuffle-1.js │ │ ├── knuth-shuffle-2.js │ │ ├── knuth-shuffle-3.js │ │ ├── knuth-shuffle-4.js │ │ └── knuth-shuffle-5.js │ ├── LZW-compression │ │ └── lzw-compression.js │ ├── Langtons-ant │ │ ├── langtons-ant-1.js │ │ ├── langtons-ant-2.js │ │ ├── langtons-ant-3.js │ │ └── langtons-ant-4.js │ ├── Largest-int-from-concatenated-ints │ │ ├── largest-int-from-concatenated-ints-1.js │ │ └── largest-int-from-concatenated-ints-2.js │ ├── Leap-year │ │ ├── leap-year-1.js │ │ └── leap-year-2.js │ ├── Least-common-multiple │ │ ├── least-common-multiple-1.js │ │ └── least-common-multiple-2.js │ ├── Letter-frequency │ │ ├── letter-frequency-1.js │ │ └── letter-frequency-2.js │ ├── Levenshtein-distance │ │ ├── levenshtein-distance-1.js │ │ ├── levenshtein-distance-2.js │ │ └── levenshtein-distance-3.js │ ├── Literals-Integer │ │ └── literals-integer.js │ ├── Literals-String │ │ └── literals-string.js │ ├── Logical-operations │ │ └── logical-operations.js │ ├── Long-multiplication │ │ ├── long-multiplication-1.js │ │ └── long-multiplication-2.js │ ├── Longest-increasing-subsequence │ │ └── longest-increasing-subsequence.js │ ├── Look-and-say-sequence │ │ ├── look-and-say-sequence-1.js │ │ └── look-and-say-sequence-2.js │ ├── Loop-over-multiple-arrays-simultaneously │ │ ├── loop-over-multiple-arrays-simultaneously-1.js │ │ ├── loop-over-multiple-arrays-simultaneously-2.js │ │ ├── loop-over-multiple-arrays-simultaneously-3.js │ │ ├── loop-over-multiple-arrays-simultaneously-4.js │ │ ├── loop-over-multiple-arrays-simultaneously-5.js │ │ └── loop-over-multiple-arrays-simultaneously-6.js │ ├── Loops-Break │ │ ├── loops-break-1.js │ │ ├── loops-break-2.js │ │ └── loops-break-3.js │ ├── Loops-Continue │ │ ├── loops-continue-1.js │ │ ├── loops-continue-2.js │ │ └── loops-continue-3.js │ ├── Loops-Do-while │ │ ├── loops-do-while-1.js │ │ ├── loops-do-while-2.js │ │ ├── loops-do-while-3.js │ │ ├── loops-do-while-4.js │ │ ├── loops-do-while-5.js │ │ ├── loops-do-while-6.js │ │ └── loops-do-while-7.js │ ├── Loops-Downward-for │ │ ├── loops-downward-for-1.js │ │ ├── loops-downward-for-2.js │ │ ├── loops-downward-for-3.js │ │ ├── loops-downward-for-4.js │ │ ├── loops-downward-for-5.js │ │ └── loops-downward-for-6.js │ ├── Loops-For-with-a-specified-step │ │ ├── loops-for-with-a-specified-step-1.js │ │ └── loops-for-with-a-specified-step-2.js │ ├── Loops-For │ │ ├── loops-for-1.js │ │ ├── loops-for-2.js │ │ ├── loops-for-3.js │ │ ├── loops-for-4.js │ │ └── loops-for-5.js │ ├── Loops-Foreach │ │ ├── loops-foreach-1.js │ │ ├── loops-foreach-2.js │ │ ├── loops-foreach-3.js │ │ ├── loops-foreach-4.js │ │ ├── loops-foreach-5.js │ │ ├── loops-foreach-6.js │ │ └── loops-foreach-7.js │ ├── Loops-Infinite │ │ ├── loops-infinite-1.js │ │ └── loops-infinite-2.js │ ├── Loops-N-plus-one-half │ │ ├── loops-n-plus-one-half-1.js │ │ ├── loops-n-plus-one-half-2.js │ │ ├── loops-n-plus-one-half-3.js │ │ ├── loops-n-plus-one-half-4.js │ │ ├── loops-n-plus-one-half-5.js │ │ ├── loops-n-plus-one-half-6.js │ │ └── loops-n-plus-one-half-7.js │ ├── Loops-Nested │ │ ├── loops-nested-1.js │ │ ├── loops-nested-2.js │ │ └── loops-nested-3.js │ ├── Loops-While │ │ ├── loops-while-1.js │ │ ├── loops-while-2.js │ │ └── loops-while-3.js │ ├── Luhn-test-of-credit-card-numbers │ │ ├── luhn-test-of-credit-card-numbers-1.js │ │ ├── luhn-test-of-credit-card-numbers-2.js │ │ ├── luhn-test-of-credit-card-numbers-3.js │ │ └── luhn-test-of-credit-card-numbers-4.js │ ├── Man-or-boy-test │ │ ├── man-or-boy-test-1.js │ │ └── man-or-boy-test-2.js │ ├── Mandelbrot-set │ │ ├── mandelbrot-set-1.js │ │ └── mandelbrot-set-2.js │ ├── Matrix-transposition │ │ ├── matrix-transposition-1.js │ │ ├── matrix-transposition-2.js │ │ ├── matrix-transposition-3.js │ │ └── matrix-transposition-4.js │ ├── Menu │ │ └── menu.js │ ├── Middle-three-digits │ │ └── middle-three-digits.js │ ├── Modular-inverse │ │ └── modular-inverse.js │ ├── Monte-Carlo-methods │ │ ├── monte-carlo-methods-1.js │ │ ├── monte-carlo-methods-2.js │ │ └── monte-carlo-methods-3.js │ ├── Monty-Hall-problem │ │ ├── monty-hall-problem-1.js │ │ ├── monty-hall-problem-2.js │ │ ├── monty-hall-problem-3.js │ │ └── monty-hall-problem-4.js │ ├── Mutual-recursion │ │ ├── mutual-recursion-1.js │ │ ├── mutual-recursion-2.js │ │ └── mutual-recursion-3.js │ ├── N-queens-problem │ │ ├── n-queens-problem-1.js │ │ └── n-queens-problem-2.js │ ├── Named-parameters │ │ ├── named-parameters-1.js │ │ └── named-parameters-2.js │ ├── Non-decimal-radices-Convert │ │ ├── non-decimal-radices-convert-1.js │ │ ├── non-decimal-radices-convert-2.js │ │ ├── non-decimal-radices-convert-3.js │ │ └── non-decimal-radices-convert-4.js │ ├── Non-decimal-radices-Input │ │ ├── non-decimal-radices-input-1.js │ │ ├── non-decimal-radices-input-2.js │ │ ├── non-decimal-radices-input-3.js │ │ ├── non-decimal-radices-input-4.js │ │ ├── non-decimal-radices-input-5.js │ │ └── non-decimal-radices-input-6.js │ ├── Non-decimal-radices-Output │ │ └── non-decimal-radices-output.js │ ├── Nth-root │ │ └── nth-root.js │ ├── Nth │ │ ├── nth-1.js │ │ ├── nth-2.js │ │ └── nth-3.js │ ├── Null-object │ │ └── null-object.js │ ├── Number-reversal-game │ │ ├── number-reversal-game-1.js │ │ ├── number-reversal-game-2.js │ │ └── number-reversal-game-3.js │ ├── Palindrome-detection │ │ ├── palindrome-detection-1.js │ │ ├── palindrome-detection-2.js │ │ └── palindrome-detection-3.js │ ├── Pangram-checker │ │ ├── pangram-checker-1.js │ │ └── pangram-checker-2.js │ ├── Parsing-RPN-calculator-algorithm │ │ ├── parsing-rpn-calculator-algorithm-1.js │ │ └── parsing-rpn-calculator-algorithm-2.js │ ├── Pascals-triangle │ │ ├── pascals-triangle-1.js │ │ ├── pascals-triangle-2.js │ │ ├── pascals-triangle-3.js │ │ └── pascals-triangle-4.js │ ├── Perfect-numbers │ │ ├── perfect-numbers-1.js │ │ ├── perfect-numbers-2.js │ │ ├── perfect-numbers-3.js │ │ ├── perfect-numbers-4.js │ │ ├── perfect-numbers-5.js │ │ ├── perfect-numbers-6.js │ │ ├── perfect-numbers-7.js │ │ ├── perfect-numbers-8.js │ │ └── perfect-numbers-9.js │ ├── Permutations │ │ ├── permutations-1.js │ │ ├── permutations-2.js │ │ ├── permutations-3.js │ │ ├── permutations-4.js │ │ ├── permutations-5.js │ │ ├── permutations-6.js │ │ └── permutations-7.js │ ├── Phrase-reversals │ │ ├── phrase-reversals-1.js │ │ └── phrase-reversals-2.js │ ├── Pick-random-element │ │ └── pick-random-element.js │ ├── Playing-cards │ │ └── playing-cards.js │ ├── Polymorphic-copy │ │ └── polymorphic-copy.js │ ├── Polymorphism │ │ └── polymorphism.js │ ├── Power-set │ │ ├── power-set-1.js │ │ ├── power-set-2.js │ │ ├── power-set-3.js │ │ ├── power-set-4.js │ │ └── power-set-5.js │ ├── Primality-by-trial-division │ │ └── primality-by-trial-division.js │ ├── Program-name │ │ ├── program-name-1.js │ │ ├── program-name-2.js │ │ └── program-name-3.js │ ├── Program-termination │ │ └── program-termination.js │ ├── Queue-Definition │ │ ├── queue-definition-1.js │ │ └── queue-definition-2.js │ ├── Quine │ │ ├── quine-1.js │ │ ├── quine-2.js │ │ ├── quine-3.js │ │ ├── quine-4.js │ │ ├── quine-5.js │ │ ├── quine-6.js │ │ └── quine-7.js │ ├── Random-numbers │ │ └── random-numbers.js │ ├── Range-expansion │ │ ├── range-expansion-1.js │ │ ├── range-expansion-2.js │ │ ├── range-expansion-3.js │ │ ├── range-expansion-4.js │ │ └── range-expansion-5.js │ ├── Read-a-file-line-by-line │ │ └── read-a-file-line-by-line.js │ ├── Read-entire-file │ │ ├── read-entire-file-1.js │ │ └── read-entire-file-2.js │ ├── Real-constants-and-functions │ │ └── real-constants-and-functions.js │ ├── Reduced-row-echelon-form │ │ └── reduced-row-echelon-form.js │ ├── Regular-expressions │ │ ├── regular-expressions-1.js │ │ └── regular-expressions-2.js │ ├── Remove-duplicate-elements │ │ ├── remove-duplicate-elements-1.js │ │ ├── remove-duplicate-elements-2.js │ │ ├── remove-duplicate-elements-3.js │ │ ├── remove-duplicate-elements-4.js │ │ ├── remove-duplicate-elements-5.js │ │ └── remove-duplicate-elements-6.js │ ├── Rename-a-file │ │ └── rename-a-file.js │ ├── Repeat-a-string │ │ ├── repeat-a-string-1.js │ │ ├── repeat-a-string-2.js │ │ ├── repeat-a-string-3.js │ │ └── repeat-a-string-4.js │ ├── Return-multiple-values │ │ └── return-multiple-values.js │ ├── Reverse-a-string │ │ ├── reverse-a-string-1.js │ │ ├── reverse-a-string-2.js │ │ └── reverse-a-string-3.js │ ├── Reverse-words-in-a-string │ │ └── reverse-words-in-a-string.js │ ├── Roman-numerals-Decode │ │ ├── roman-numerals-decode-1.js │ │ ├── roman-numerals-decode-2.js │ │ ├── roman-numerals-decode-3.js │ │ ├── roman-numerals-decode-4.js │ │ ├── roman-numerals-decode-5.js │ │ ├── roman-numerals-decode-6.js │ │ ├── roman-numerals-decode-7.js │ │ └── roman-numerals-decode-8.js │ ├── Roman-numerals-Encode │ │ ├── roman-numerals-encode-1.js │ │ ├── roman-numerals-encode-2.js │ │ ├── roman-numerals-encode-3.js │ │ ├── roman-numerals-encode-4.js │ │ └── roman-numerals-encode-5.js │ ├── Rot-13 │ │ ├── rot-13-1.js │ │ └── rot-13-2.js │ ├── Run-length-encoding │ │ ├── run-length-encoding-1.js │ │ ├── run-length-encoding-2.js │ │ └── run-length-encoding-3.js │ ├── SEDOLs │ │ └── sedols.js │ ├── Search-a-list │ │ ├── search-a-list-1.js │ │ ├── search-a-list-2.js │ │ ├── search-a-list-3.js │ │ └── search-a-list-4.js │ ├── Self-describing-numbers │ │ └── self-describing-numbers.js │ ├── Semordnilap │ │ ├── semordnilap-1.js │ │ └── semordnilap-2.js │ ├── Sequence-of-non-squares │ │ ├── sequence-of-non-squares-1.js │ │ ├── sequence-of-non-squares-2.js │ │ └── sequence-of-non-squares-3.js │ ├── Show-the-epoch │ │ └── show-the-epoch.js │ ├── Sieve-of-Eratosthenes │ │ ├── sieve-of-eratosthenes-1.js │ │ ├── sieve-of-eratosthenes-2.js │ │ ├── sieve-of-eratosthenes-3.js │ │ ├── sieve-of-eratosthenes-4.js │ │ └── sieve-of-eratosthenes-5.js │ ├── Singleton │ │ └── singleton.js │ ├── Sleep │ │ └── sleep.js │ ├── Sort-an-integer-array │ │ └── sort-an-integer-array.js │ ├── Sort-using-a-custom-comparator │ │ ├── sort-using-a-custom-comparator-1.js │ │ ├── sort-using-a-custom-comparator-2.js │ │ └── sort-using-a-custom-comparator-3.js │ ├── Sorting-algorithms-Bogosort │ │ └── sorting-algorithms-bogosort.js │ ├── Sorting-algorithms-Bubble-sort │ │ ├── sorting-algorithms-bubble-sort-1.js │ │ ├── sorting-algorithms-bubble-sort-2.js │ │ └── sorting-algorithms-bubble-sort-3.js │ ├── Sorting-algorithms-Cocktail-sort │ │ └── sorting-algorithms-cocktail-sort.js │ ├── Sorting-algorithms-Comb-sort │ │ └── sorting-algorithms-comb-sort.js │ ├── Sorting-algorithms-Counting-sort │ │ ├── sorting-algorithms-counting-sort-1.js │ │ └── sorting-algorithms-counting-sort-2.js │ ├── Sorting-algorithms-Gnome-sort │ │ └── sorting-algorithms-gnome-sort.js │ ├── Sorting-algorithms-Insertion-sort │ │ └── sorting-algorithms-insertion-sort.js │ ├── Sorting-algorithms-Merge-sort │ │ └── sorting-algorithms-merge-sort.js │ ├── Sorting-algorithms-Quicksort │ │ ├── sorting-algorithms-quicksort-1.js │ │ ├── sorting-algorithms-quicksort-2.js │ │ ├── sorting-algorithms-quicksort-3.js │ │ ├── sorting-algorithms-quicksort-4.js │ │ ├── sorting-algorithms-quicksort-5.js │ │ └── sorting-algorithms-quicksort-6.js │ ├── Sorting-algorithms-Selection-sort │ │ └── sorting-algorithms-selection-sort.js │ ├── Sorting-algorithms-Shell-sort │ │ └── sorting-algorithms-shell-sort.js │ ├── Sorting-algorithms-Stooge-sort │ │ ├── sorting-algorithms-stooge-sort-1.js │ │ └── sorting-algorithms-stooge-sort-2.js │ ├── Stack │ │ ├── stack-1.js │ │ ├── stack-2.js │ │ └── stack-3.js │ ├── String-case │ │ ├── string-case-1.js │ │ └── string-case-2.js │ ├── String-concatenation │ │ └── string-concatenation.js │ ├── String-interpolation--included- │ │ ├── string-interpolation--included--1.js │ │ └── string-interpolation--included--2.js │ ├── String-length │ │ ├── string-length-1.js │ │ └── string-length-2.js │ ├── String-matching │ │ └── string-matching.js │ ├── Strip-a-set-of-characters-from-a-string │ │ ├── strip-a-set-of-characters-from-a-string-1.js │ │ ├── strip-a-set-of-characters-from-a-string-2.js │ │ └── strip-a-set-of-characters-from-a-string-3.js │ ├── Strip-whitespace-from-a-string-Top-and-tail │ │ ├── strip-whitespace-from-a-string-top-and-tail-1.js │ │ └── strip-whitespace-from-a-string-top-and-tail-2.js │ ├── Substring-Top-and-tail │ │ └── substring-top-and-tail.js │ ├── Substring │ │ ├── substring-1.js │ │ ├── substring-2.js │ │ └── substring-3.js │ ├── Sudoku │ │ ├── sudoku-1.js │ │ └── sudoku-2.js │ ├── Sum-and-product-of-an-array │ │ ├── sum-and-product-of-an-array-1.js │ │ ├── sum-and-product-of-an-array-2.js │ │ └── sum-and-product-of-an-array-3.js │ ├── Sum-digits-of-an-integer │ │ ├── sum-digits-of-an-integer-1.js │ │ └── sum-digits-of-an-integer-2.js │ ├── Sum-of-a-series │ │ ├── sum-of-a-series-1.js │ │ ├── sum-of-a-series-2.js │ │ ├── sum-of-a-series-3.js │ │ ├── sum-of-a-series-4.js │ │ └── sum-of-a-series-5.js │ ├── Sum-of-squares │ │ ├── sum-of-squares-1.js │ │ ├── sum-of-squares-2.js │ │ ├── sum-of-squares-3.js │ │ ├── sum-of-squares-4.js │ │ └── sum-of-squares-5.js │ ├── Symmetric-difference │ │ ├── symmetric-difference-1.js │ │ ├── symmetric-difference-2.js │ │ ├── symmetric-difference-3.js │ │ └── symmetric-difference-4.js │ ├── System-time │ │ └── system-time.js │ ├── Take-notes-on-the-command-line │ │ └── take-notes-on-the-command-line.js │ ├── Temperature-conversion │ │ ├── temperature-conversion-1.js │ │ └── temperature-conversion-2.js │ ├── Ternary-logic │ │ ├── ternary-logic-1.js │ │ └── ternary-logic-2.js │ ├── Text-processing-2 │ │ └── text-processing-2.js │ ├── Text-processing-Max-licenses-in-use │ │ └── text-processing-max-licenses-in-use.js │ ├── The-Twelve-Days-of-Christmas │ │ ├── the-twelve-days-of-christmas-1.js │ │ ├── the-twelve-days-of-christmas-2.js │ │ ├── the-twelve-days-of-christmas-3.js │ │ └── the-twelve-days-of-christmas-4.js │ ├── Tokenize-a-string │ │ └── tokenize-a-string.js │ ├── Top-rank-per-group │ │ ├── top-rank-per-group-1.js │ │ ├── top-rank-per-group-2.js │ │ └── top-rank-per-group-3.js │ ├── Towers-of-Hanoi │ │ ├── towers-of-hanoi-1.js │ │ ├── towers-of-hanoi-2.js │ │ ├── towers-of-hanoi-3.js │ │ └── towers-of-hanoi-4.js │ ├── Tree-traversal │ │ ├── tree-traversal-1.js │ │ ├── tree-traversal-2.js │ │ ├── tree-traversal-3.js │ │ ├── tree-traversal-4.js │ │ ├── tree-traversal-5.js │ │ ├── tree-traversal-6.js │ │ └── tree-traversal-7.js │ ├── Trigonometric-functions │ │ └── trigonometric-functions.js │ ├── URL-decoding │ │ └── url-decoding.js │ ├── URL-encoding │ │ └── url-encoding.js │ ├── Unix-ls │ │ └── unix-ls.js │ ├── User-input-Text │ │ ├── user-input-text-1.js │ │ └── user-input-text-2.js │ ├── Variadic-function │ │ ├── variadic-function-1.js │ │ ├── variadic-function-2.js │ │ ├── variadic-function-3.js │ │ └── variadic-function-4.js │ ├── Vector-products │ │ └── vector-products.js │ ├── Vigen-re-cipher │ │ └── vigen-re-cipher.js │ ├── Walk-a-directory-Non-recursively │ │ └── walk-a-directory-non-recursively.js │ ├── Walk-a-directory-Recursively │ │ └── walk-a-directory-recursively.js │ ├── Web-scraping │ │ └── web-scraping.js │ ├── XML-Input │ │ ├── xml-input-1.js │ │ ├── xml-input-2.js │ │ └── xml-input-3.js │ ├── XML-XPath │ │ ├── xml-xpath-1.js │ │ └── xml-xpath-2.js │ ├── Y-combinator │ │ ├── y-combinator-1.js │ │ ├── y-combinator-2.js │ │ ├── y-combinator-3.js │ │ ├── y-combinator-4.js │ │ ├── y-combinator-5.js │ │ ├── y-combinator-6.js │ │ ├── y-combinator-7.js │ │ └── y-combinator-8.js │ ├── Zeckendorf-number-representation │ │ └── zeckendorf-number-representation.js │ ├── Zero-to-the-zero-power │ │ └── zero-to-the-zero-power.js │ └── Zig-zag-matrix │ │ ├── zig-zag-matrix-1.js │ │ ├── zig-zag-matrix-2.js │ │ ├── zig-zag-matrix-3.js │ │ ├── zig-zag-matrix-4.js │ │ └── zig-zag-matrix-5.js ├── PHP │ ├── 100-doors │ │ ├── 100-doors-1.php │ │ └── 100-doors-2.php │ ├── 24-game │ │ └── 24-game.php │ ├── A+B │ │ ├── a+b-1.php │ │ └── a+b-2.php │ ├── ABC-Problem │ │ └── abc-problem.php │ ├── Accumulator-factory │ │ ├── accumulator-factory-1.php │ │ └── accumulator-factory-2.php │ ├── Ackermann-function │ │ └── ackermann-function.php │ ├── Anagrams-Deranged-anagrams │ │ └── anagrams-deranged-anagrams.php │ ├── Anagrams │ │ └── anagrams.php │ ├── Anonymous-recursion │ │ ├── anonymous-recursion-1.php │ │ ├── anonymous-recursion-2.php │ │ └── anonymous-recursion-3.php │ ├── Apply-a-callback-to-an-array │ │ └── apply-a-callback-to-an-array.php │ ├── Arithmetic-Integer │ │ └── arithmetic-integer.php │ ├── Arithmetic-geometric-mean │ │ └── arithmetic-geometric-mean.php │ ├── Array-concatenation │ │ └── array-concatenation.php │ ├── Arrays │ │ ├── arrays-1.php │ │ ├── arrays-10.php │ │ ├── arrays-11.php │ │ ├── arrays-12.php │ │ ├── arrays-13.php │ │ ├── arrays-2.php │ │ ├── arrays-3.php │ │ ├── arrays-4.php │ │ ├── arrays-5.php │ │ ├── arrays-6.php │ │ ├── arrays-7.php │ │ ├── arrays-8.php │ │ └── arrays-9.php │ ├── Associative-array-Creation │ │ ├── associative-array-creation-1.php │ │ └── associative-array-creation-2.php │ ├── Associative-array-Iteration │ │ └── associative-array-iteration.php │ ├── Averages-Arithmetic-mean │ │ └── averages-arithmetic-mean.php │ ├── Averages-Median │ │ └── averages-median.php │ ├── Averages-Mode │ │ └── averages-mode.php │ ├── Averages-Pythagorean-means │ │ └── averages-pythagorean-means.php │ ├── Averages-Root-mean-square │ │ └── averages-root-mean-square.php │ ├── Balanced-brackets │ │ └── balanced-brackets.php │ ├── Binary-digits │ │ └── binary-digits.php │ ├── Binary-search │ │ ├── binary-search-1.php │ │ └── binary-search-2.php │ ├── Bitwise-operations │ │ └── bitwise-operations.php │ ├── Bulls-and-cows │ │ └── bulls-and-cows.php │ ├── CSV-data-manipulation │ │ └── csv-data-manipulation.php │ ├── CSV-to-HTML-translation │ │ └── csv-to-html-translation.php │ ├── Caesar-cipher │ │ └── caesar-cipher.php │ ├── Call-an-object-method │ │ └── call-an-object-method.php │ ├── Catalan-numbers │ │ └── catalan-numbers.php │ ├── Character-codes │ │ └── character-codes.php │ ├── Check-that-file-exists │ │ └── check-that-file-exists.php │ ├── Classes │ │ └── classes.php │ ├── Closures-Value-capture │ │ ├── closures-value-capture-1.php │ │ └── closures-value-capture-2.php │ ├── Collections │ │ └── collections.php │ ├── Combinations-with-repetitions │ │ └── combinations-with-repetitions.php │ ├── Combinations │ │ ├── combinations-1.php │ │ └── combinations-2.php │ ├── Comma-quibbling │ │ └── comma-quibbling.php │ ├── Command-line-arguments │ │ └── command-line-arguments.php │ ├── Comments │ │ ├── comments-1.php │ │ ├── comments-2.php │ │ ├── comments-3.php │ │ └── comments-4.php │ ├── Compound-data-type │ │ ├── compound-data-type-1.php │ │ ├── compound-data-type-2.php │ │ └── compound-data-type-3.php │ ├── Copy-a-string │ │ └── copy-a-string.php │ ├── Count-in-octal │ │ └── count-in-octal.php │ ├── Count-occurrences-of-a-substring │ │ └── count-occurrences-of-a-substring.php │ ├── Create-an-HTML-table │ │ ├── create-an-html-table-1.php │ │ └── create-an-html-table-2.php │ ├── Date-format │ │ └── date-format.php │ ├── Date-manipulation │ │ └── date-manipulation.php │ ├── Day-of-the-week │ │ └── day-of-the-week.php │ ├── Delegates │ │ └── delegates.php │ ├── Delete-a-file │ │ └── delete-a-file.php │ ├── Detect-division-by-zero │ │ ├── detect-division-by-zero-1.php │ │ └── detect-division-by-zero-2.php │ ├── Determine-if-a-string-is-numeric │ │ └── determine-if-a-string-is-numeric.php │ ├── Discordian-date │ │ └── discordian-date.php │ ├── Dot-product │ │ └── dot-product.php │ ├── Empty-string │ │ └── empty-string.php │ ├── Enforced-immutability │ │ ├── enforced-immutability-1.php │ │ └── enforced-immutability-2.php │ ├── Enumerations │ │ └── enumerations.php │ ├── Environment-variables │ │ └── environment-variables.php │ ├── Equilibrium-index │ │ └── equilibrium-index.php │ ├── Evaluate-binomial-coefficients │ │ ├── evaluate-binomial-coefficients-1.php │ │ └── evaluate-binomial-coefficients-2.php │ ├── Even-or-odd │ │ └── even-or-odd.php │ ├── Evolutionary-algorithm │ │ └── evolutionary-algorithm.php │ ├── Exceptions │ │ ├── exceptions-1.php │ │ ├── exceptions-2.php │ │ └── exceptions-3.php │ ├── Execute-a-system-command │ │ ├── execute-a-system-command-1.php │ │ └── execute-a-system-command-2.php │ ├── Factorial │ │ ├── factorial-1.php │ │ ├── factorial-2.php │ │ ├── factorial-3.php │ │ └── factorial-4.php │ ├── Factors-of-an-integer │ │ └── factors-of-an-integer.php │ ├── Fibonacci-n-step-number-sequences │ │ └── fibonacci-n-step-number-sequences.php │ ├── Fibonacci-sequence │ │ ├── fibonacci-sequence-1.php │ │ └── fibonacci-sequence-2.php │ ├── File-input-output │ │ ├── file-input-output-1.php │ │ └── file-input-output-2.php │ ├── File-modification-time │ │ └── file-modification-time.php │ ├── File-size │ │ └── file-size.php │ ├── Filter │ │ ├── filter-1.php │ │ └── filter-2.php │ ├── Find-limit-of-recursion │ │ └── find-limit-of-recursion.php │ ├── Find-the-last-Sunday-of-each-month │ │ └── find-the-last-sunday-of-each-month.php │ ├── Find-the-missing-permutation │ │ └── find-the-missing-permutation.php │ ├── First-class-functions │ │ └── first-class-functions.php │ ├── Flatten-a-list │ │ ├── flatten-a-list-1.php │ │ ├── flatten-a-list-2.php │ │ ├── flatten-a-list-3.php │ │ ├── flatten-a-list-4.php │ │ ├── flatten-a-list-5.php │ │ └── flatten-a-list-6.php │ ├── Floyds-triangle │ │ └── floyds-triangle.php │ ├── Forest-fire │ │ └── forest-fire.php │ ├── Formatted-numeric-output │ │ ├── formatted-numeric-output-1.php │ │ └── formatted-numeric-output-2.php │ ├── Forward-difference │ │ └── forward-difference.php │ ├── Fractal-tree │ │ └── fractal-tree.php │ ├── Function-composition │ │ ├── function-composition-1.php │ │ └── function-composition-2.php │ ├── Function-definition │ │ └── function-definition.php │ ├── Generate-lower-case-ASCII-alphabet │ │ └── generate-lower-case-ascii-alphabet.php │ ├── Generator-Exponential │ │ └── generator-exponential.php │ ├── Generic-swap │ │ └── generic-swap.php │ ├── Greatest-common-divisor │ │ ├── greatest-common-divisor-1.php │ │ └── greatest-common-divisor-2.php │ ├── Greatest-element-of-a-list │ │ └── greatest-element-of-a-list.php │ ├── Greatest-subsequential-sum │ │ ├── greatest-subsequential-sum-1.php │ │ └── greatest-subsequential-sum-2.php │ ├── Guess-the-number-With-feedback │ │ └── guess-the-number-with-feedback.php │ ├── Guess-the-number │ │ └── guess-the-number.php │ ├── HTTP │ │ └── http.php │ ├── Hailstone-sequence │ │ └── hailstone-sequence.php │ ├── Happy-numbers │ │ └── happy-numbers.php │ ├── Hash-from-two-arrays │ │ ├── hash-from-two-arrays-1.php │ │ └── hash-from-two-arrays-2.php │ ├── Hello-world-Graphical │ │ └── hello-world-graphical.php │ ├── Hello-world-Line-printer │ │ ├── hello-world-line-printer-1.php │ │ └── hello-world-line-printer-2.php │ ├── Hello-world-Standard-error │ │ ├── hello-world-standard-error-1.php │ │ └── hello-world-standard-error-2.php │ ├── Hello-world-Text │ │ ├── hello-world-text-1.php │ │ └── hello-world-text-2.php │ ├── Higher-order-functions │ │ ├── higher-order-functions-1.php │ │ └── higher-order-functions-2.php │ ├── Horners-rule-for-polynomial-evaluation │ │ ├── horners-rule-for-polynomial-evaluation-1.php │ │ └── horners-rule-for-polynomial-evaluation-2.php │ ├── Huffman-coding │ │ └── huffman-coding.php │ ├── IBAN │ │ └── iban.php │ ├── Identity-matrix │ │ └── identity-matrix.php │ ├── Increment-a-numerical-string │ │ └── increment-a-numerical-string.php │ ├── Infinity │ │ └── infinity.php │ ├── Inheritance-Single │ │ └── inheritance-single.php │ ├── Input-loop │ │ ├── input-loop-1.php │ │ ├── input-loop-2.php │ │ └── input-loop-3.php │ ├── Integer-comparison │ │ └── integer-comparison.php │ ├── JSON │ │ └── json.php │ ├── Jensens-Device │ │ └── jensens-device.php │ ├── Josephus-problem │ │ └── josephus-problem.php │ ├── Kaprekar-numbers │ │ └── kaprekar-numbers.php │ ├── Knapsack-problem-0-1 │ │ ├── knapsack-problem-0-1-1.php │ │ └── knapsack-problem-0-1-2.php │ ├── Knuth-shuffle │ │ └── knuth-shuffle.php │ ├── LZW-compression │ │ └── lzw-compression.php │ ├── Langtons-ant │ │ └── langtons-ant.php │ ├── Largest-int-from-concatenated-ints │ │ └── largest-int-from-concatenated-ints.php │ ├── Leap-year │ │ ├── leap-year-1.php │ │ └── leap-year-2.php │ ├── Least-common-multiple │ │ └── least-common-multiple.php │ ├── Letter-frequency │ │ └── letter-frequency.php │ ├── Levenshtein-distance │ │ └── levenshtein-distance.php │ ├── Literals-Integer │ │ └── literals-integer.php │ ├── Literals-String │ │ └── literals-string.php │ ├── Logical-operations │ │ └── logical-operations.php │ ├── Long-multiplication │ │ └── long-multiplication.php │ ├── Longest-increasing-subsequence │ │ └── longest-increasing-subsequence.php │ ├── Look-and-say-sequence │ │ └── look-and-say-sequence.php │ ├── Loop-over-multiple-arrays-simultaneously │ │ └── loop-over-multiple-arrays-simultaneously.php │ ├── Loops-Break │ │ └── loops-break.php │ ├── Loops-Continue │ │ └── loops-continue.php │ ├── Loops-Do-while │ │ └── loops-do-while.php │ ├── Loops-Downward-for │ │ ├── loops-downward-for-1.php │ │ └── loops-downward-for-2.php │ ├── Loops-For-with-a-specified-step │ │ └── loops-for-with-a-specified-step.php │ ├── Loops-For │ │ ├── loops-for-1.php │ │ └── loops-for-2.php │ ├── Loops-Foreach │ │ └── loops-foreach.php │ ├── Loops-Infinite │ │ └── loops-infinite.php │ ├── Loops-N-plus-one-half │ │ └── loops-n-plus-one-half.php │ ├── Loops-Nested │ │ └── loops-nested.php │ ├── Loops-While │ │ └── loops-while.php │ ├── Luhn-test-of-credit-card-numbers │ │ ├── luhn-test-of-credit-card-numbers-1.php │ │ └── luhn-test-of-credit-card-numbers-2.php │ ├── Man-or-boy-test │ │ ├── man-or-boy-test-1.php │ │ └── man-or-boy-test-2.php │ ├── Mandelbrot-set │ │ └── mandelbrot-set.php │ ├── Matrix-transposition │ │ └── matrix-transposition.php │ ├── Menu │ │ └── menu.php │ ├── Middle-three-digits │ │ └── middle-three-digits.php │ ├── Modular-inverse │ │ └── modular-inverse.php │ ├── Monte-Carlo-methods │ │ └── monte-carlo-methods.php │ ├── Monty-Hall-problem │ │ └── monty-hall-problem.php │ ├── Mutual-recursion │ │ └── mutual-recursion.php │ ├── N-queens-problem │ │ └── n-queens-problem.php │ ├── Named-parameters │ │ └── named-parameters.php │ ├── Non-decimal-radices-Convert │ │ ├── non-decimal-radices-convert-1.php │ │ ├── non-decimal-radices-convert-2.php │ │ ├── non-decimal-radices-convert-3.php │ │ └── non-decimal-radices-convert-4.php │ ├── Non-decimal-radices-Input │ │ ├── non-decimal-radices-input-1.php │ │ ├── non-decimal-radices-input-2.php │ │ └── non-decimal-radices-input-3.php │ ├── Non-decimal-radices-Output │ │ ├── non-decimal-radices-output-1.php │ │ └── non-decimal-radices-output-2.php │ ├── Nth-root │ │ └── nth-root.php │ ├── Nth │ │ └── nth.php │ ├── Null-object │ │ └── null-object.php │ ├── Number-reversal-game │ │ └── number-reversal-game.php │ ├── Palindrome-detection │ │ ├── palindrome-detection-1.php │ │ └── palindrome-detection-2.php │ ├── Pangram-checker │ │ └── pangram-checker.php │ ├── Parsing-RPN-calculator-algorithm │ │ └── parsing-rpn-calculator-algorithm.php │ ├── Pascals-triangle │ │ └── pascals-triangle.php │ ├── Perfect-numbers │ │ └── perfect-numbers.php │ ├── Permutations │ │ └── permutations.php │ ├── Phrase-reversals │ │ └── phrase-reversals.php │ ├── Pick-random-element │ │ └── pick-random-element.php │ ├── Playing-cards │ │ ├── playing-cards-1.php │ │ └── playing-cards-2.php │ ├── Polymorphic-copy │ │ └── polymorphic-copy.php │ ├── Polymorphism │ │ ├── polymorphism-1.php │ │ ├── polymorphism-2.php │ │ └── polymorphism-3.php │ ├── Power-set │ │ ├── power-set-1.php │ │ └── power-set-2.php │ ├── Primality-by-trial-division │ │ ├── primality-by-trial-division-1.php │ │ └── primality-by-trial-division-2.php │ ├── Program-name │ │ └── program-name.php │ ├── Program-termination │ │ └── program-termination.php │ ├── Queue-Definition │ │ ├── queue-definition-1.php │ │ └── queue-definition-2.php │ ├── Quine │ │ └── quine.php │ ├── Random-numbers │ │ └── random-numbers.php │ ├── Range-expansion │ │ └── range-expansion.php │ ├── Read-a-file-line-by-line │ │ ├── read-a-file-line-by-line-1.php │ │ └── read-a-file-line-by-line-2.php │ ├── Read-entire-file │ │ └── read-entire-file.php │ ├── Real-constants-and-functions │ │ └── real-constants-and-functions.php │ ├── Reduced-row-echelon-form │ │ └── reduced-row-echelon-form.php │ ├── Regular-expressions │ │ └── regular-expressions.php │ ├── Remove-duplicate-elements │ │ └── remove-duplicate-elements.php │ ├── Rename-a-file │ │ └── rename-a-file.php │ ├── Repeat-a-string │ │ └── repeat-a-string.php │ ├── Return-multiple-values │ │ ├── return-multiple-values-1.php │ │ ├── return-multiple-values-2.php │ │ └── return-multiple-values-3.php │ ├── Reverse-a-string │ │ ├── reverse-a-string-1.php │ │ └── reverse-a-string-2.php │ ├── Reverse-words-in-a-string │ │ ├── reverse-words-in-a-string-1.php │ │ └── reverse-words-in-a-string-2.php │ ├── Roman-numerals-Decode │ │ └── roman-numerals-decode.php │ ├── Roman-numerals-Encode │ │ └── roman-numerals-encode.php │ ├── Rot-13 │ │ ├── rot-13-1.php │ │ └── rot-13-2.php │ ├── Run-length-encoding │ │ └── run-length-encoding.php │ ├── SEDOLs │ │ └── sedols.php │ ├── Search-a-list │ │ └── search-a-list.php │ ├── Self-describing-numbers │ │ └── self-describing-numbers.php │ ├── Semordnilap │ │ └── semordnilap.php │ ├── Sequence-of-non-squares │ │ └── sequence-of-non-squares.php │ ├── Show-the-epoch │ │ └── show-the-epoch.php │ ├── Sieve-of-Eratosthenes │ │ └── sieve-of-eratosthenes.php │ ├── Singleton │ │ └── singleton.php │ ├── Sleep │ │ ├── sleep-1.php │ │ ├── sleep-2.php │ │ └── sleep-3.php │ ├── Sort-an-integer-array │ │ └── sort-an-integer-array.php │ ├── Sort-using-a-custom-comparator │ │ └── sort-using-a-custom-comparator.php │ ├── Sorting-algorithms-Bogosort │ │ └── sorting-algorithms-bogosort.php │ ├── Sorting-algorithms-Bubble-sort │ │ └── sorting-algorithms-bubble-sort.php │ ├── Sorting-algorithms-Cocktail-sort │ │ └── sorting-algorithms-cocktail-sort.php │ ├── Sorting-algorithms-Comb-sort │ │ └── sorting-algorithms-comb-sort.php │ ├── Sorting-algorithms-Counting-sort │ │ ├── sorting-algorithms-counting-sort-1.php │ │ └── sorting-algorithms-counting-sort-2.php │ ├── Sorting-algorithms-Gnome-sort │ │ └── sorting-algorithms-gnome-sort.php │ ├── Sorting-algorithms-Insertion-sort │ │ └── sorting-algorithms-insertion-sort.php │ ├── Sorting-algorithms-Merge-sort │ │ └── sorting-algorithms-merge-sort.php │ ├── Sorting-algorithms-Quicksort │ │ ├── sorting-algorithms-quicksort-1.php │ │ └── sorting-algorithms-quicksort-2.php │ ├── Sorting-algorithms-Selection-sort │ │ ├── sorting-algorithms-selection-sort-1.php │ │ └── sorting-algorithms-selection-sort-2.php │ ├── Sorting-algorithms-Shell-sort │ │ └── sorting-algorithms-shell-sort.php │ ├── Sorting-algorithms-Stooge-sort │ │ └── sorting-algorithms-stooge-sort.php │ ├── Stack │ │ └── stack.php │ ├── String-case │ │ └── string-case.php │ ├── String-concatenation │ │ └── string-concatenation.php │ ├── String-interpolation--included- │ │ └── string-interpolation--included-.php │ ├── String-length │ │ └── string-length.php │ ├── String-matching │ │ ├── string-matching-1.php │ │ └── string-matching-2.php │ ├── Strip-a-set-of-characters-from-a-string │ │ └── strip-a-set-of-characters-from-a-string.php │ ├── Strip-whitespace-from-a-string-Top-and-tail │ │ └── strip-whitespace-from-a-string-top-and-tail.php │ ├── Substring-Top-and-tail │ │ └── substring-top-and-tail.php │ ├── Substring │ │ └── substring.php │ ├── Sudoku │ │ └── sudoku.php │ ├── Sum-and-product-of-an-array │ │ └── sum-and-product-of-an-array.php │ ├── Sum-digits-of-an-integer │ │ └── sum-digits-of-an-integer.php │ ├── Sum-of-a-series │ │ └── sum-of-a-series.php │ ├── Sum-of-squares │ │ ├── sum-of-squares-1.php │ │ └── sum-of-squares-2.php │ ├── Symmetric-difference │ │ └── symmetric-difference.php │ ├── System-time │ │ ├── system-time-1.php │ │ ├── system-time-2.php │ │ └── system-time-3.php │ ├── Take-notes-on-the-command-line │ │ └── take-notes-on-the-command-line.php │ ├── Temperature-conversion │ │ └── temperature-conversion.php │ ├── Ternary-logic │ │ └── ternary-logic.php │ ├── Text-processing-2 │ │ └── text-processing-2.php │ ├── Text-processing-Max-licenses-in-use │ │ └── text-processing-max-licenses-in-use.php │ ├── The-Twelve-Days-of-Christmas │ │ └── the-twelve-days-of-christmas.php │ ├── Tokenize-a-string │ │ └── tokenize-a-string.php │ ├── Top-rank-per-group │ │ └── top-rank-per-group.php │ ├── Towers-of-Hanoi │ │ └── towers-of-hanoi.php │ ├── Tree-traversal │ │ └── tree-traversal.php │ ├── Trigonometric-functions │ │ └── trigonometric-functions.php │ ├── URL-decoding │ │ └── url-decoding.php │ ├── URL-encoding │ │ └── url-encoding.php │ ├── Unix-ls │ │ └── unix-ls.php │ ├── User-input-Text │ │ └── user-input-text.php │ ├── Variadic-function │ │ ├── variadic-function-1.php │ │ ├── variadic-function-2.php │ │ ├── variadic-function-3.php │ │ └── variadic-function-4.php │ ├── Vector-products │ │ └── vector-products.php │ ├── Vigen-re-cipher │ │ └── vigen-re-cipher.php │ ├── Walk-a-directory-Non-recursively │ │ ├── walk-a-directory-non-recursively-1.php │ │ ├── walk-a-directory-non-recursively-2.php │ │ └── walk-a-directory-non-recursively-3.php │ ├── Walk-a-directory-Recursively │ │ ├── walk-a-directory-recursively-1.php │ │ └── walk-a-directory-recursively-2.php │ ├── Web-scraping │ │ ├── web-scraping-1.php │ │ └── web-scraping-2.php │ ├── XML-Input │ │ └── xml-input.php │ ├── XML-XPath │ │ └── xml-xpath.php │ ├── Y-combinator │ │ ├── y-combinator-1.php │ │ ├── y-combinator-2.php │ │ ├── y-combinator-3.php │ │ └── y-combinator-4.php │ ├── Zeckendorf-number-representation │ │ └── zeckendorf-number-representation.php │ ├── Zero-to-the-zero-power │ │ └── zero-to-the-zero-power.php │ └── Zig-zag-matrix │ │ └── zig-zag-matrix.php ├── Python │ ├── 100-doors │ │ ├── 100-doors-1.py │ │ ├── 100-doors-2.py │ │ ├── 100-doors-3.py │ │ ├── 100-doors-4.py │ │ ├── 100-doors-5.py │ │ └── 100-doors-6.py │ ├── 24-game │ │ ├── 24-game-1.py │ │ └── 24-game-2.py │ ├── A+B │ │ ├── a+b-1.py │ │ └── a+b-2.py │ ├── ABC-Problem │ │ ├── abc-problem-1.py │ │ ├── abc-problem-2.py │ │ └── abc-problem-3.py │ ├── Accumulator-factory │ │ ├── accumulator-factory-1.py │ │ ├── accumulator-factory-2.py │ │ └── accumulator-factory-3.py │ ├── Ackermann-function │ │ ├── ackermann-function-1.py │ │ ├── ackermann-function-2.py │ │ ├── ackermann-function-3.py │ │ └── ackermann-function-4.py │ ├── Anagrams-Deranged-anagrams │ │ ├── anagrams-deranged-anagrams-1.py │ │ └── anagrams-deranged-anagrams-2.py │ ├── Anagrams │ │ ├── anagrams-1.py │ │ ├── anagrams-2.py │ │ └── anagrams-3.py │ ├── Anonymous-recursion │ │ ├── anonymous-recursion-1.py │ │ ├── anonymous-recursion-2.py │ │ ├── anonymous-recursion-3.py │ │ └── anonymous-recursion-4.py │ ├── Apply-a-callback-to-an-array │ │ ├── apply-a-callback-to-an-array-1.py │ │ ├── apply-a-callback-to-an-array-2.py │ │ ├── apply-a-callback-to-an-array-3.py │ │ └── apply-a-callback-to-an-array-4.py │ ├── Arithmetic-Integer │ │ ├── arithmetic-integer-1.py │ │ ├── arithmetic-integer-2.py │ │ └── arithmetic-integer-3.py │ ├── Arithmetic-geometric-mean │ │ ├── arithmetic-geometric-mean-1.py │ │ └── arithmetic-geometric-mean-2.py │ ├── Array-concatenation │ │ ├── array-concatenation-1.py │ │ └── array-concatenation-2.py │ ├── Arrays │ │ ├── arrays-1.py │ │ ├── arrays-2.py │ │ ├── arrays-3.py │ │ ├── arrays-4.py │ │ ├── arrays-5.py │ │ ├── arrays-6.py │ │ └── arrays-7.py │ ├── Associative-array-Creation │ │ ├── associative-array-creation-1.py │ │ ├── associative-array-creation-2.py │ │ └── associative-array-creation-3.py │ ├── Associative-array-Iteration │ │ └── associative-array-iteration.py │ ├── Averages-Arithmetic-mean │ │ ├── averages-arithmetic-mean-1.py │ │ ├── averages-arithmetic-mean-2.py │ │ ├── averages-arithmetic-mean-3.py │ │ ├── averages-arithmetic-mean-4.py │ │ ├── averages-arithmetic-mean-5.py │ │ └── averages-arithmetic-mean-6.py │ ├── Averages-Median │ │ └── averages-median.py │ ├── Averages-Mode │ │ ├── averages-mode-1.py │ │ ├── averages-mode-2.py │ │ └── averages-mode-3.py │ ├── Averages-Pythagorean-means │ │ └── averages-pythagorean-means.py │ ├── Averages-Root-mean-square │ │ └── averages-root-mean-square.py │ ├── Balanced-brackets │ │ └── balanced-brackets.py │ ├── Binary-digits │ │ ├── binary-digits-1.py │ │ ├── binary-digits-2.py │ │ └── binary-digits-3.py │ ├── Binary-search │ │ ├── binary-search-1.py │ │ ├── binary-search-2.py │ │ ├── binary-search-3.py │ │ ├── binary-search-4.py │ │ └── binary-search-5.py │ ├── Bitwise-operations │ │ ├── bitwise-operations-1.py │ │ ├── bitwise-operations-2.py │ │ └── bitwise-operations-3.py │ ├── Bulls-and-cows │ │ └── bulls-and-cows.py │ ├── CSV-data-manipulation │ │ └── csv-data-manipulation.py │ ├── CSV-to-HTML-translation │ │ ├── csv-to-html-translation-1.py │ │ ├── csv-to-html-translation-2.py │ │ ├── csv-to-html-translation-3.py │ │ └── csv-to-html-translation-4.py │ ├── Caesar-cipher │ │ ├── caesar-cipher-1.py │ │ ├── caesar-cipher-2.py │ │ ├── caesar-cipher-3.py │ │ └── caesar-cipher-4.py │ ├── Call-an-object-method │ │ └── call-an-object-method.py │ ├── Catalan-numbers │ │ └── catalan-numbers.py │ ├── Character-codes │ │ ├── character-codes-1.py │ │ ├── character-codes-2.py │ │ └── character-codes-3.py │ ├── Check-that-file-exists │ │ └── check-that-file-exists.py │ ├── Classes │ │ ├── classes-1.py │ │ └── classes-2.py │ ├── Closures-Value-capture │ │ ├── closures-value-capture-1.py │ │ ├── closures-value-capture-2.py │ │ ├── closures-value-capture-3.py │ │ ├── closures-value-capture-4.py │ │ ├── closures-value-capture-5.py │ │ ├── closures-value-capture-6.py │ │ └── closures-value-capture-7.py │ ├── Collections │ │ └── collections.py │ ├── Combinations-with-repetitions │ │ └── combinations-with-repetitions.py │ ├── Combinations │ │ ├── combinations-1.py │ │ ├── combinations-2.py │ │ ├── combinations-3.py │ │ └── combinations-4.py │ ├── Comma-quibbling │ │ ├── comma-quibbling-1.py │ │ ├── comma-quibbling-2.py │ │ └── comma-quibbling-3.py │ ├── Command-line-arguments │ │ └── command-line-arguments.py │ ├── Comments │ │ ├── comments-1.py │ │ ├── comments-2.py │ │ └── comments-3.py │ ├── Compound-data-type │ │ ├── compound-data-type-1.py │ │ ├── compound-data-type-2.py │ │ ├── compound-data-type-3.py │ │ ├── compound-data-type-4.py │ │ └── compound-data-type-5.py │ ├── Copy-a-string │ │ ├── copy-a-string-1.py │ │ └── copy-a-string-2.py │ ├── Count-in-octal │ │ └── count-in-octal.py │ ├── Count-occurrences-of-a-substring │ │ └── count-occurrences-of-a-substring.py │ ├── Create-an-HTML-table │ │ ├── create-an-html-table-1.py │ │ └── create-an-html-table-2.py │ ├── Date-format │ │ └── date-format.py │ ├── Date-manipulation │ │ └── date-manipulation.py │ ├── Day-of-the-week │ │ └── day-of-the-week.py │ ├── Delegates │ │ └── delegates.py │ ├── Delete-a-file │ │ ├── delete-a-file-1.py │ │ └── delete-a-file-2.py │ ├── Detect-division-by-zero │ │ └── detect-division-by-zero.py │ ├── Determine-if-a-string-is-numeric │ │ ├── determine-if-a-string-is-numeric-1.py │ │ ├── determine-if-a-string-is-numeric-2.py │ │ ├── determine-if-a-string-is-numeric-3.py │ │ └── determine-if-a-string-is-numeric-4.py │ ├── Discordian-date │ │ └── discordian-date.py │ ├── Dot-product │ │ └── dot-product.py │ ├── Empty-string │ │ └── empty-string.py │ ├── Enforced-immutability │ │ ├── enforced-immutability-1.py │ │ └── enforced-immutability-2.py │ ├── Enumerations │ │ ├── enumerations-1.py │ │ ├── enumerations-2.py │ │ └── enumerations-3.py │ ├── Environment-variables │ │ └── environment-variables.py │ ├── Equilibrium-index │ │ ├── equilibrium-index-1.py │ │ ├── equilibrium-index-2.py │ │ ├── equilibrium-index-3.py │ │ ├── equilibrium-index-4.py │ │ └── equilibrium-index-5.py │ ├── Evaluate-binomial-coefficients │ │ ├── evaluate-binomial-coefficients-1.py │ │ └── evaluate-binomial-coefficients-2.py │ ├── Even-or-odd │ │ ├── even-or-odd-1.py │ │ └── even-or-odd-2.py │ ├── Evolutionary-algorithm │ │ ├── evolutionary-algorithm-1.py │ │ └── evolutionary-algorithm-2.py │ ├── Exceptions │ │ ├── exceptions-1.py │ │ ├── exceptions-2.py │ │ ├── exceptions-3.py │ │ ├── exceptions-4.py │ │ ├── exceptions-5.py │ │ ├── exceptions-6.py │ │ └── exceptions-7.py │ ├── Execute-a-system-command │ │ ├── execute-a-system-command-1.py │ │ ├── execute-a-system-command-2.py │ │ ├── execute-a-system-command-3.py │ │ └── execute-a-system-command-4.py │ ├── Factorial │ │ ├── factorial-1.py │ │ ├── factorial-2.py │ │ ├── factorial-3.py │ │ ├── factorial-4.py │ │ └── factorial-5.py │ ├── Factors-of-an-integer │ │ ├── factors-of-an-integer-1.py │ │ ├── factors-of-an-integer-2.py │ │ ├── factors-of-an-integer-3.py │ │ └── factors-of-an-integer-4.py │ ├── Fibonacci-n-step-number-sequences │ │ ├── fibonacci-n-step-number-sequences-1.py │ │ ├── fibonacci-n-step-number-sequences-2.py │ │ └── fibonacci-n-step-number-sequences-3.py │ ├── Fibonacci-sequence │ │ ├── fibonacci-sequence-1.py │ │ ├── fibonacci-sequence-10.py │ │ ├── fibonacci-sequence-11.py │ │ ├── fibonacci-sequence-12.py │ │ ├── fibonacci-sequence-2.py │ │ ├── fibonacci-sequence-3.py │ │ ├── fibonacci-sequence-4.py │ │ ├── fibonacci-sequence-5.py │ │ ├── fibonacci-sequence-6.py │ │ ├── fibonacci-sequence-7.py │ │ ├── fibonacci-sequence-8.py │ │ └── fibonacci-sequence-9.py │ ├── File-input-output │ │ ├── file-input-output-1.py │ │ ├── file-input-output-2.py │ │ ├── file-input-output-3.py │ │ └── file-input-output-4.py │ ├── File-modification-time │ │ └── file-modification-time.py │ ├── File-size │ │ └── file-size.py │ ├── Filter │ │ ├── filter-1.py │ │ ├── filter-2.py │ │ └── filter-3.py │ ├── Find-limit-of-recursion │ │ ├── find-limit-of-recursion-1.py │ │ ├── find-limit-of-recursion-2.py │ │ ├── find-limit-of-recursion-3.py │ │ └── find-limit-of-recursion-4.py │ ├── Find-the-last-Sunday-of-each-month │ │ ├── find-the-last-sunday-of-each-month-1.py │ │ └── find-the-last-sunday-of-each-month-2.py │ ├── Find-the-missing-permutation │ │ ├── find-the-missing-permutation-1.py │ │ ├── find-the-missing-permutation-2.py │ │ ├── find-the-missing-permutation-3.py │ │ └── find-the-missing-permutation-4.py │ ├── First-class-functions │ │ └── first-class-functions.py │ ├── Flatten-a-list │ │ ├── flatten-a-list-1.py │ │ ├── flatten-a-list-2.py │ │ └── flatten-a-list-3.py │ ├── Floyds-triangle │ │ ├── floyds-triangle-1.py │ │ └── floyds-triangle-2.py │ ├── Forest-fire │ │ └── forest-fire.py │ ├── Formatted-numeric-output │ │ ├── formatted-numeric-output-1.py │ │ └── formatted-numeric-output-2.py │ ├── Forward-difference │ │ └── forward-difference.py │ ├── Fractal-tree │ │ └── fractal-tree.py │ ├── Function-composition │ │ ├── function-composition-1.py │ │ └── function-composition-2.py │ ├── Function-definition │ │ ├── function-definition-1.py │ │ ├── function-definition-2.py │ │ └── function-definition-3.py │ ├── Generate-lower-case-ASCII-alphabet │ │ └── generate-lower-case-ascii-alphabet.py │ ├── Generator-Exponential │ │ └── generator-exponential.py │ ├── Generic-swap │ │ ├── generic-swap-1.py │ │ └── generic-swap-2.py │ ├── Greatest-common-divisor │ │ ├── greatest-common-divisor-1.py │ │ ├── greatest-common-divisor-2.py │ │ ├── greatest-common-divisor-3.py │ │ └── greatest-common-divisor-4.py │ ├── Greatest-element-of-a-list │ │ ├── greatest-element-of-a-list-1.py │ │ ├── greatest-element-of-a-list-2.py │ │ ├── greatest-element-of-a-list-3.py │ │ └── greatest-element-of-a-list-4.py │ ├── Greatest-subsequential-sum │ │ ├── greatest-subsequential-sum-1.py │ │ ├── greatest-subsequential-sum-2.py │ │ ├── greatest-subsequential-sum-3.py │ │ ├── greatest-subsequential-sum-4.py │ │ └── greatest-subsequential-sum-5.py │ ├── Guess-the-number-With-feedback │ │ └── guess-the-number-with-feedback.py │ ├── Guess-the-number │ │ └── guess-the-number.py │ ├── HTTP │ │ ├── http-1.py │ │ ├── http-2.py │ │ ├── http-3.py │ │ └── http-4.py │ ├── Hailstone-sequence │ │ └── hailstone-sequence.py │ ├── Happy-numbers │ │ └── happy-numbers.py │ ├── Hash-from-two-arrays │ │ ├── hash-from-two-arrays-1.py │ │ ├── hash-from-two-arrays-2.py │ │ ├── hash-from-two-arrays-3.py │ │ └── hash-from-two-arrays-4.py │ ├── Hello-world-Graphical │ │ ├── hello-world-graphical-1.py │ │ ├── hello-world-graphical-2.py │ │ ├── hello-world-graphical-3.py │ │ ├── hello-world-graphical-4.py │ │ ├── hello-world-graphical-5.py │ │ └── hello-world-graphical-6.py │ ├── Hello-world-Line-printer │ │ ├── hello-world-line-printer-1.py │ │ └── hello-world-line-printer-2.py │ ├── Hello-world-Standard-error │ │ ├── hello-world-standard-error-1.py │ │ ├── hello-world-standard-error-2.py │ │ └── hello-world-standard-error-3.py │ ├── Hello-world-Text │ │ ├── hello-world-text-1.py │ │ ├── hello-world-text-2.py │ │ ├── hello-world-text-3.py │ │ ├── hello-world-text-4.py │ │ ├── hello-world-text-5.py │ │ └── hello-world-text-6.py │ ├── Higher-order-functions │ │ ├── higher-order-functions-1.py │ │ └── higher-order-functions-2.py │ ├── Horners-rule-for-polynomial-evaluation │ │ ├── horners-rule-for-polynomial-evaluation-1.py │ │ ├── horners-rule-for-polynomial-evaluation-2.py │ │ └── horners-rule-for-polynomial-evaluation-3.py │ ├── Huffman-coding │ │ └── huffman-coding.py │ ├── IBAN │ │ └── iban.py │ ├── Identity-matrix │ │ ├── identity-matrix-1.py │ │ ├── identity-matrix-2.py │ │ └── identity-matrix-3.py │ ├── Increment-a-numerical-string │ │ └── increment-a-numerical-string.py │ ├── Infinity │ │ ├── infinity-1.py │ │ └── infinity-2.py │ ├── Inheritance-Single │ │ ├── inheritance-single-1.py │ │ └── inheritance-single-2.py │ ├── Input-loop │ │ ├── input-loop-1.py │ │ ├── input-loop-2.py │ │ ├── input-loop-3.py │ │ ├── input-loop-4.py │ │ └── input-loop-5.py │ ├── Integer-comparison │ │ ├── integer-comparison-1.py │ │ └── integer-comparison-2.py │ ├── JSON │ │ ├── json-1.py │ │ └── json-2.py │ ├── Jensens-Device │ │ └── jensens-device.py │ ├── Josephus-problem │ │ ├── josephus-problem-1.py │ │ ├── josephus-problem-2.py │ │ └── josephus-problem-3.py │ ├── Kaprekar-numbers │ │ ├── kaprekar-numbers-1.py │ │ ├── kaprekar-numbers-2.py │ │ ├── kaprekar-numbers-3.py │ │ └── kaprekar-numbers-4.py │ ├── Knapsack-problem-0-1 │ │ ├── knapsack-problem-0-1-1.py │ │ ├── knapsack-problem-0-1-2.py │ │ └── knapsack-problem-0-1-3.py │ ├── Knuth-shuffle │ │ └── knuth-shuffle.py │ ├── LZW-compression │ │ └── lzw-compression.py │ ├── Langtons-ant │ │ └── langtons-ant.py │ ├── Largest-int-from-concatenated-ints │ │ ├── largest-int-from-concatenated-ints-1.py │ │ ├── largest-int-from-concatenated-ints-2.py │ │ ├── largest-int-from-concatenated-ints-3.py │ │ └── largest-int-from-concatenated-ints-4.py │ ├── Leap-year │ │ ├── leap-year-1.py │ │ ├── leap-year-2.py │ │ └── leap-year-3.py │ ├── Least-common-multiple │ │ ├── least-common-multiple-1.py │ │ ├── least-common-multiple-2.py │ │ ├── least-common-multiple-3.py │ │ └── least-common-multiple-4.py │ ├── Letter-frequency │ │ ├── letter-frequency-1.py │ │ ├── letter-frequency-2.py │ │ ├── letter-frequency-3.py │ │ └── letter-frequency-4.py │ ├── Levenshtein-distance │ │ ├── levenshtein-distance-1.py │ │ ├── levenshtein-distance-2.py │ │ └── levenshtein-distance-3.py │ ├── Literals-Integer │ │ ├── literals-integer-1.py │ │ ├── literals-integer-2.py │ │ └── literals-integer-3.py │ ├── Literals-String │ │ ├── literals-string-1.py │ │ ├── literals-string-2.py │ │ └── literals-string-3.py │ ├── Logical-operations │ │ └── logical-operations.py │ ├── Long-multiplication │ │ ├── long-multiplication-1.py │ │ ├── long-multiplication-2.py │ │ └── long-multiplication-3.py │ ├── Longest-increasing-subsequence │ │ ├── longest-increasing-subsequence-1.py │ │ ├── longest-increasing-subsequence-2.py │ │ └── longest-increasing-subsequence-3.py │ ├── Look-and-say-sequence │ │ ├── look-and-say-sequence-1.py │ │ ├── look-and-say-sequence-2.py │ │ ├── look-and-say-sequence-3.py │ │ └── look-and-say-sequence-4.py │ ├── Loop-over-multiple-arrays-simultaneously │ │ ├── loop-over-multiple-arrays-simultaneously-1.py │ │ ├── loop-over-multiple-arrays-simultaneously-2.py │ │ ├── loop-over-multiple-arrays-simultaneously-3.py │ │ └── loop-over-multiple-arrays-simultaneously-4.py │ ├── Loops-Break │ │ └── loops-break.py │ ├── Loops-Continue │ │ └── loops-continue.py │ ├── Loops-Do-while │ │ ├── loops-do-while-1.py │ │ └── loops-do-while-2.py │ ├── Loops-Downward-for │ │ ├── loops-downward-for-1.py │ │ ├── loops-downward-for-2.py │ │ └── loops-downward-for-3.py │ ├── Loops-For-with-a-specified-step │ │ ├── loops-for-with-a-specified-step-1.py │ │ └── loops-for-with-a-specified-step-2.py │ ├── Loops-For │ │ ├── loops-for-1.py │ │ └── loops-for-2.py │ ├── Loops-Foreach │ │ ├── loops-foreach-1.py │ │ ├── loops-foreach-2.py │ │ ├── loops-foreach-3.py │ │ └── loops-foreach-4.py │ ├── Loops-Infinite │ │ └── loops-infinite.py │ ├── Loops-N-plus-one-half │ │ ├── loops-n-plus-one-half-1.py │ │ └── loops-n-plus-one-half-2.py │ ├── Loops-Nested │ │ ├── loops-nested-1.py │ │ ├── loops-nested-2.py │ │ └── loops-nested-3.py │ ├── Loops-While │ │ └── loops-while.py │ ├── Luhn-test-of-credit-card-numbers │ │ └── luhn-test-of-credit-card-numbers.py │ ├── Man-or-boy-test │ │ ├── man-or-boy-test-1.py │ │ ├── man-or-boy-test-2.py │ │ └── man-or-boy-test-3.py │ ├── Mandelbrot-set │ │ ├── mandelbrot-set-1.py │ │ ├── mandelbrot-set-2.py │ │ └── mandelbrot-set-3.py │ ├── Matrix-transposition │ │ └── matrix-transposition.py │ ├── Menu │ │ └── menu.py │ ├── Middle-three-digits │ │ └── middle-three-digits.py │ ├── Modular-inverse │ │ └── modular-inverse.py │ ├── Monte-Carlo-methods │ │ ├── monte-carlo-methods-1.py │ │ ├── monte-carlo-methods-2.py │ │ └── monte-carlo-methods-3.py │ ├── Monty-Hall-problem │ │ ├── monty-hall-problem-1.py │ │ └── monty-hall-problem-2.py │ ├── Mutual-recursion │ │ └── mutual-recursion.py │ ├── N-queens-problem │ │ ├── n-queens-problem-1.py │ │ ├── n-queens-problem-2.py │ │ ├── n-queens-problem-3.py │ │ ├── n-queens-problem-4.py │ │ ├── n-queens-problem-5.py │ │ └── n-queens-problem-6.py │ ├── Named-parameters │ │ ├── named-parameters-1.py │ │ └── named-parameters-2.py │ ├── Non-decimal-radices-Convert │ │ ├── non-decimal-radices-convert-1.py │ │ └── non-decimal-radices-convert-2.py │ ├── Non-decimal-radices-Input │ │ └── non-decimal-radices-input.py │ ├── Non-decimal-radices-Output │ │ ├── non-decimal-radices-output-1.py │ │ ├── non-decimal-radices-output-2.py │ │ └── non-decimal-radices-output-3.py │ ├── Nth-root │ │ ├── nth-root-1.py │ │ └── nth-root-2.py │ ├── Nth │ │ ├── nth-1.py │ │ └── nth-2.py │ ├── Null-object │ │ └── null-object.py │ ├── Number-reversal-game │ │ └── number-reversal-game.py │ ├── Palindrome-detection │ │ ├── palindrome-detection-1.py │ │ ├── palindrome-detection-2.py │ │ ├── palindrome-detection-3.py │ │ ├── palindrome-detection-4.py │ │ └── palindrome-detection-5.py │ ├── Pangram-checker │ │ └── pangram-checker.py │ ├── Parsing-RPN-calculator-algorithm │ │ ├── parsing-rpn-calculator-algorithm-1.py │ │ └── parsing-rpn-calculator-algorithm-2.py │ ├── Pascals-triangle │ │ ├── pascals-triangle-1.py │ │ └── pascals-triangle-2.py │ ├── Perfect-numbers │ │ ├── perfect-numbers-1.py │ │ └── perfect-numbers-2.py │ ├── Permutations │ │ ├── permutations-1.py │ │ ├── permutations-2.py │ │ ├── permutations-3.py │ │ └── permutations-4.py │ ├── Phrase-reversals │ │ └── phrase-reversals.py │ ├── Pick-random-element │ │ └── pick-random-element.py │ ├── Playing-cards │ │ ├── playing-cards-1.py │ │ └── playing-cards-2.py │ ├── Polymorphic-copy │ │ ├── polymorphic-copy-1.py │ │ ├── polymorphic-copy-2.py │ │ └── polymorphic-copy-3.py │ ├── Polymorphism │ │ ├── polymorphism-1.py │ │ ├── polymorphism-2.py │ │ ├── polymorphism-3.py │ │ └── polymorphism-4.py │ ├── Power-set │ │ ├── power-set-1.py │ │ ├── power-set-2.py │ │ ├── power-set-3.py │ │ ├── power-set-4.py │ │ └── power-set-5.py │ ├── Primality-by-trial-division │ │ ├── primality-by-trial-division-1.py │ │ ├── primality-by-trial-division-2.py │ │ ├── primality-by-trial-division-3.py │ │ └── primality-by-trial-division-4.py │ ├── Program-name │ │ ├── program-name-1.py │ │ └── program-name-2.py │ ├── Program-termination │ │ ├── program-termination-1.py │ │ └── program-termination-2.py │ ├── Queue-Definition │ │ ├── queue-definition-1.py │ │ ├── queue-definition-2.py │ │ └── queue-definition-3.py │ ├── Quine │ │ ├── quine-1.py │ │ ├── quine-10.py │ │ ├── quine-11.py │ │ ├── quine-12.py │ │ ├── quine-2.py │ │ ├── quine-3.py │ │ ├── quine-4.py │ │ ├── quine-5.py │ │ ├── quine-6.py │ │ ├── quine-7.py │ │ ├── quine-8.py │ │ └── quine-9.py │ ├── Random-numbers │ │ ├── random-numbers-1.py │ │ ├── random-numbers-2.py │ │ └── random-numbers-3.py │ ├── Range-expansion │ │ ├── range-expansion-1.py │ │ └── range-expansion-2.py │ ├── Read-a-file-line-by-line │ │ ├── read-a-file-line-by-line-1.py │ │ └── read-a-file-line-by-line-2.py │ ├── Read-entire-file │ │ ├── read-entire-file-1.py │ │ ├── read-entire-file-2.py │ │ └── read-entire-file-3.py │ ├── Real-constants-and-functions │ │ └── real-constants-and-functions.py │ ├── Reduced-row-echelon-form │ │ └── reduced-row-echelon-form.py │ ├── Regular-expressions │ │ └── regular-expressions.py │ ├── Remove-duplicate-elements │ │ ├── remove-duplicate-elements-1.py │ │ ├── remove-duplicate-elements-2.py │ │ ├── remove-duplicate-elements-3.py │ │ ├── remove-duplicate-elements-4.py │ │ └── remove-duplicate-elements-5.py │ ├── Rename-a-file │ │ ├── rename-a-file-1.py │ │ └── rename-a-file-2.py │ ├── Repeat-a-string │ │ ├── repeat-a-string-1.py │ │ └── repeat-a-string-2.py │ ├── Return-multiple-values │ │ ├── return-multiple-values-1.py │ │ └── return-multiple-values-2.py │ ├── Reverse-a-string │ │ ├── reverse-a-string-1.py │ │ ├── reverse-a-string-2.py │ │ ├── reverse-a-string-3.py │ │ └── reverse-a-string-4.py │ ├── Reverse-words-in-a-string │ │ ├── reverse-words-in-a-string-1.py │ │ └── reverse-words-in-a-string-2.py │ ├── Roman-numerals-Decode │ │ ├── roman-numerals-decode-1.py │ │ ├── roman-numerals-decode-2.py │ │ └── roman-numerals-decode-3.py │ ├── Roman-numerals-Encode │ │ ├── roman-numerals-encode-1.py │ │ ├── roman-numerals-encode-2.py │ │ ├── roman-numerals-encode-3.py │ │ └── roman-numerals-encode-4.py │ ├── Rot-13 │ │ ├── rot-13-1.py │ │ ├── rot-13-2.py │ │ ├── rot-13-3.py │ │ ├── rot-13-4.py │ │ └── rot-13-5.py │ ├── Run-length-encoding │ │ ├── run-length-encoding-1.py │ │ ├── run-length-encoding-2.py │ │ └── run-length-encoding-3.py │ ├── SEDOLs │ │ └── sedols.py │ ├── Search-a-list │ │ ├── search-a-list-1.py │ │ ├── search-a-list-2.py │ │ └── search-a-list-3.py │ ├── Self-describing-numbers │ │ ├── self-describing-numbers-1.py │ │ └── self-describing-numbers-2.py │ ├── Semordnilap │ │ ├── semordnilap-1.py │ │ └── semordnilap-2.py │ ├── Sequence-of-non-squares │ │ └── sequence-of-non-squares.py │ ├── Show-the-epoch │ │ └── show-the-epoch.py │ ├── Sieve-of-Eratosthenes │ │ ├── sieve-of-eratosthenes-1.py │ │ ├── sieve-of-eratosthenes-10.py │ │ ├── sieve-of-eratosthenes-11.py │ │ ├── sieve-of-eratosthenes-12.py │ │ ├── sieve-of-eratosthenes-13.py │ │ ├── sieve-of-eratosthenes-14.py │ │ ├── sieve-of-eratosthenes-2.py │ │ ├── sieve-of-eratosthenes-3.py │ │ ├── sieve-of-eratosthenes-4.py │ │ ├── sieve-of-eratosthenes-5.py │ │ ├── sieve-of-eratosthenes-6.py │ │ ├── sieve-of-eratosthenes-7.py │ │ ├── sieve-of-eratosthenes-8.py │ │ └── sieve-of-eratosthenes-9.py │ ├── Singleton │ │ ├── singleton-1.py │ │ └── singleton-2.py │ ├── Sleep │ │ └── sleep.py │ ├── Sort-an-integer-array │ │ ├── sort-an-integer-array-1.py │ │ └── sort-an-integer-array-2.py │ ├── Sort-using-a-custom-comparator │ │ ├── sort-using-a-custom-comparator-1.py │ │ ├── sort-using-a-custom-comparator-2.py │ │ └── sort-using-a-custom-comparator-3.py │ ├── Sorting-algorithms-Bogosort │ │ ├── sorting-algorithms-bogosort-1.py │ │ ├── sorting-algorithms-bogosort-2.py │ │ ├── sorting-algorithms-bogosort-3.py │ │ └── sorting-algorithms-bogosort-4.py │ ├── Sorting-algorithms-Bubble-sort │ │ └── sorting-algorithms-bubble-sort.py │ ├── Sorting-algorithms-Cocktail-sort │ │ ├── sorting-algorithms-cocktail-sort-1.py │ │ ├── sorting-algorithms-cocktail-sort-2.py │ │ └── sorting-algorithms-cocktail-sort-3.py │ ├── Sorting-algorithms-Comb-sort │ │ └── sorting-algorithms-comb-sort.py │ ├── Sorting-algorithms-Counting-sort │ │ ├── sorting-algorithms-counting-sort-1.py │ │ └── sorting-algorithms-counting-sort-2.py │ ├── Sorting-algorithms-Gnome-sort │ │ └── sorting-algorithms-gnome-sort.py │ ├── Sorting-algorithms-Insertion-sort │ │ ├── sorting-algorithms-insertion-sort-1.py │ │ ├── sorting-algorithms-insertion-sort-2.py │ │ └── sorting-algorithms-insertion-sort-3.py │ ├── Sorting-algorithms-Merge-sort │ │ ├── sorting-algorithms-merge-sort-1.py │ │ └── sorting-algorithms-merge-sort-2.py │ ├── Sorting-algorithms-Quicksort │ │ ├── sorting-algorithms-quicksort-1.py │ │ ├── sorting-algorithms-quicksort-2.py │ │ ├── sorting-algorithms-quicksort-3.py │ │ ├── sorting-algorithms-quicksort-4.py │ │ ├── sorting-algorithms-quicksort-5.py │ │ ├── sorting-algorithms-quicksort-6.py │ │ └── sorting-algorithms-quicksort-7.py │ ├── Sorting-algorithms-Selection-sort │ │ └── sorting-algorithms-selection-sort.py │ ├── Sorting-algorithms-Shell-sort │ │ └── sorting-algorithms-shell-sort.py │ ├── Sorting-algorithms-Stooge-sort │ │ ├── sorting-algorithms-stooge-sort-1.py │ │ └── sorting-algorithms-stooge-sort-2.py │ ├── Stack │ │ ├── stack-1.py │ │ ├── stack-2.py │ │ ├── stack-3.py │ │ ├── stack-4.py │ │ └── stack-5.py │ ├── String-case │ │ ├── string-case-1.py │ │ └── string-case-2.py │ ├── String-concatenation │ │ ├── string-concatenation-1.py │ │ └── string-concatenation-2.py │ ├── String-interpolation--included- │ │ ├── string-interpolation--included--1.py │ │ ├── string-interpolation--included--2.py │ │ ├── string-interpolation--included--3.py │ │ └── string-interpolation--included--4.py │ ├── String-length │ │ ├── string-length-1.py │ │ ├── string-length-10.py │ │ ├── string-length-11.py │ │ ├── string-length-12.py │ │ ├── string-length-13.py │ │ ├── string-length-14.py │ │ ├── string-length-15.py │ │ ├── string-length-2.py │ │ ├── string-length-3.py │ │ ├── string-length-4.py │ │ ├── string-length-5.py │ │ ├── string-length-6.py │ │ ├── string-length-7.py │ │ ├── string-length-8.py │ │ └── string-length-9.py │ ├── String-matching │ │ └── string-matching.py │ ├── Strip-a-set-of-characters-from-a-string │ │ ├── strip-a-set-of-characters-from-a-string-1.py │ │ ├── strip-a-set-of-characters-from-a-string-2.py │ │ ├── strip-a-set-of-characters-from-a-string-3.py │ │ └── strip-a-set-of-characters-from-a-string-4.py │ ├── Strip-whitespace-from-a-string-Top-and-tail │ │ └── strip-whitespace-from-a-string-top-and-tail.py │ ├── Substring-Top-and-tail │ │ └── substring-top-and-tail.py │ ├── Substring │ │ └── substring.py │ ├── Sudoku │ │ └── sudoku.py │ ├── Sum-and-product-of-an-array │ │ ├── sum-and-product-of-an-array-1.py │ │ ├── sum-and-product-of-an-array-2.py │ │ ├── sum-and-product-of-an-array-3.py │ │ └── sum-and-product-of-an-array-4.py │ ├── Sum-digits-of-an-integer │ │ ├── sum-digits-of-an-integer-1.py │ │ └── sum-digits-of-an-integer-2.py │ ├── Sum-of-a-series │ │ └── sum-of-a-series.py │ ├── Sum-of-squares │ │ ├── sum-of-squares-1.py │ │ ├── sum-of-squares-2.py │ │ └── sum-of-squares-3.py │ ├── Symmetric-difference │ │ ├── symmetric-difference-1.py │ │ ├── symmetric-difference-2.py │ │ └── symmetric-difference-3.py │ ├── System-time │ │ └── system-time.py │ ├── Take-notes-on-the-command-line │ │ └── take-notes-on-the-command-line.py │ ├── Temperature-conversion │ │ ├── temperature-conversion-1.py │ │ └── temperature-conversion-2.py │ ├── Ternary-logic │ │ └── ternary-logic.py │ ├── Text-processing-2 │ │ ├── text-processing-2-1.py │ │ └── text-processing-2-2.py │ ├── Text-processing-Max-licenses-in-use │ │ └── text-processing-max-licenses-in-use.py │ ├── The-Twelve-Days-of-Christmas │ │ └── the-twelve-days-of-christmas.py │ ├── Tokenize-a-string │ │ ├── tokenize-a-string-1.py │ │ └── tokenize-a-string-2.py │ ├── Top-rank-per-group │ │ ├── top-rank-per-group-1.py │ │ └── top-rank-per-group-2.py │ ├── Towers-of-Hanoi │ │ └── towers-of-hanoi.py │ ├── Tree-traversal │ │ ├── tree-traversal-1.py │ │ └── tree-traversal-2.py │ ├── Trigonometric-functions │ │ └── trigonometric-functions.py │ ├── URL-decoding │ │ └── url-decoding.py │ ├── URL-encoding │ │ └── url-encoding.py │ ├── Unix-ls │ │ └── unix-ls.py │ ├── User-input-Text │ │ ├── user-input-text-1.py │ │ ├── user-input-text-2.py │ │ ├── user-input-text-3.py │ │ ├── user-input-text-4.py │ │ ├── user-input-text-5.py │ │ └── user-input-text-6.py │ ├── Variadic-function │ │ ├── variadic-function-1.py │ │ ├── variadic-function-2.py │ │ ├── variadic-function-3.py │ │ └── variadic-function-4.py │ ├── Vector-products │ │ └── vector-products.py │ ├── Vigen-re-cipher │ │ ├── vigen-re-cipher-1.py │ │ └── vigen-re-cipher-2.py │ ├── Walk-a-directory-Non-recursively │ │ ├── walk-a-directory-non-recursively-1.py │ │ └── walk-a-directory-non-recursively-2.py │ ├── Walk-a-directory-Recursively │ │ ├── walk-a-directory-recursively-1.py │ │ ├── walk-a-directory-recursively-2.py │ │ └── walk-a-directory-recursively-3.py │ ├── Web-scraping │ │ └── web-scraping.py │ ├── XML-Input │ │ └── xml-input.py │ ├── XML-XPath │ │ ├── xml-xpath-1.py │ │ ├── xml-xpath-2.py │ │ └── xml-xpath-3.py │ ├── Y-combinator │ │ ├── y-combinator-1.py │ │ └── y-combinator-2.py │ ├── Zeckendorf-number-representation │ │ ├── zeckendorf-number-representation-1.py │ │ └── zeckendorf-number-representation-2.py │ ├── Zero-to-the-zero-power │ │ └── zero-to-the-zero-power.py │ └── Zig-zag-matrix │ │ ├── zig-zag-matrix-1.py │ │ ├── zig-zag-matrix-2.py │ │ ├── zig-zag-matrix-3.py │ │ ├── zig-zag-matrix-4.py │ │ └── zig-zag-matrix-5.py └── Ruby │ ├── 100-doors │ ├── 100-doors-1.rb │ ├── 100-doors-2.rb │ ├── 100-doors-3.rb │ └── 100-doors-4.rb │ ├── 24-game │ └── 24-game.rb │ ├── A+B │ └── a+b.rb │ ├── ABC-Problem │ └── abc-problem.rb │ ├── Accumulator-factory │ └── accumulator-factory.rb │ ├── Ackermann-function │ ├── ackermann-function-1.rb │ └── ackermann-function-2.rb │ ├── Anagrams-Deranged-anagrams │ └── anagrams-deranged-anagrams.rb │ ├── Anagrams │ ├── anagrams-1.rb │ └── anagrams-2.rb │ ├── Anonymous-recursion │ ├── anonymous-recursion-1.rb │ ├── anonymous-recursion-2.rb │ ├── anonymous-recursion-3.rb │ ├── anonymous-recursion-4.rb │ ├── anonymous-recursion-5.rb │ ├── anonymous-recursion-6.rb │ └── anonymous-recursion-7.rb │ ├── Apply-a-callback-to-an-array │ ├── apply-a-callback-to-an-array-1.rb │ ├── apply-a-callback-to-an-array-2.rb │ └── apply-a-callback-to-an-array-3.rb │ ├── Arithmetic-Integer │ └── arithmetic-integer.rb │ ├── Arithmetic-geometric-mean │ ├── arithmetic-geometric-mean-1.rb │ └── arithmetic-geometric-mean-2.rb │ ├── Array-concatenation │ ├── array-concatenation-1.rb │ └── array-concatenation-2.rb │ ├── Arrays │ └── arrays.rb │ ├── Associative-array-Creation │ ├── associative-array-creation-1.rb │ ├── associative-array-creation-2.rb │ ├── associative-array-creation-3.rb │ └── associative-array-creation-4.rb │ ├── Associative-array-Iteration │ ├── associative-array-iteration-1.rb │ └── associative-array-iteration-2.rb │ ├── Averages-Arithmetic-mean │ └── averages-arithmetic-mean.rb │ ├── Averages-Median │ ├── averages-median-1.rb │ └── averages-median-2.rb │ ├── Averages-Mode │ ├── averages-mode-1.rb │ └── averages-mode-2.rb │ ├── Averages-Pythagorean-means │ └── averages-pythagorean-means.rb │ ├── Averages-Root-mean-square │ ├── averages-root-mean-square-1.rb │ └── averages-root-mean-square-2.rb │ ├── Balanced-brackets │ └── balanced-brackets.rb │ ├── Binary-digits │ ├── binary-digits-1.rb │ └── binary-digits-2.rb │ ├── Binary-search │ ├── binary-search-1.rb │ ├── binary-search-2.rb │ └── binary-search-3.rb │ ├── Bitwise-operations │ └── bitwise-operations.rb │ ├── Bulls-and-cows │ ├── bulls-and-cows-1.rb │ └── bulls-and-cows-2.rb │ ├── CSV-data-manipulation │ └── csv-data-manipulation.rb │ ├── CSV-to-HTML-translation │ ├── csv-to-html-translation-1.rb │ └── csv-to-html-translation-2.rb │ ├── Caesar-cipher │ └── caesar-cipher.rb │ ├── Call-an-object-method │ └── call-an-object-method.rb │ ├── Catalan-numbers │ └── catalan-numbers.rb │ ├── Character-codes │ ├── character-codes-1.rb │ └── character-codes-2.rb │ ├── Check-that-file-exists │ ├── check-that-file-exists-1.rb │ └── check-that-file-exists-2.rb │ ├── Classes │ └── classes.rb │ ├── Closures-Value-capture │ └── closures-value-capture.rb │ ├── Collections │ ├── collections-1.rb │ ├── collections-2.rb │ ├── collections-3.rb │ ├── collections-4.rb │ ├── collections-5.rb │ └── collections-6.rb │ ├── Combinations-with-repetitions │ └── combinations-with-repetitions.rb │ ├── Combinations │ └── combinations.rb │ ├── Comma-quibbling │ └── comma-quibbling.rb │ ├── Command-line-arguments │ └── command-line-arguments.rb │ ├── Comments │ └── comments.rb │ ├── Compound-data-type │ └── compound-data-type.rb │ ├── Copy-a-string │ ├── copy-a-string-1.rb │ └── copy-a-string-2.rb │ ├── Count-in-octal │ └── count-in-octal.rb │ ├── Count-occurrences-of-a-substring │ └── count-occurrences-of-a-substring.rb │ ├── Create-an-HTML-table │ ├── create-an-html-table-1.rb │ ├── create-an-html-table-2.rb │ └── create-an-html-table-3.rb │ ├── Date-format │ └── date-format.rb │ ├── Date-manipulation │ ├── date-manipulation-1.rb │ ├── date-manipulation-2.rb │ └── date-manipulation-3.rb │ ├── Day-of-the-week │ ├── day-of-the-week-1.rb │ └── day-of-the-week-2.rb │ ├── Delegates │ ├── delegates-1.rb │ └── delegates-2.rb │ ├── Delete-a-file │ └── delete-a-file.rb │ ├── Detect-division-by-zero │ ├── detect-division-by-zero-1.rb │ ├── detect-division-by-zero-2.rb │ ├── detect-division-by-zero-3.rb │ └── detect-division-by-zero-4.rb │ ├── Determine-if-a-string-is-numeric │ ├── determine-if-a-string-is-numeric-1.rb │ ├── determine-if-a-string-is-numeric-2.rb │ └── determine-if-a-string-is-numeric-3.rb │ ├── Discordian-date │ ├── discordian-date-1.rb │ └── discordian-date-2.rb │ ├── Dot-product │ ├── dot-product-1.rb │ └── dot-product-2.rb │ ├── Empty-string │ ├── empty-string-1.rb │ ├── empty-string-2.rb │ ├── empty-string-3.rb │ └── empty-string-4.rb │ ├── Enforced-immutability │ ├── enforced-immutability-1.rb │ └── enforced-immutability-2.rb │ ├── Enumerations │ ├── enumerations-1.rb │ └── enumerations-2.rb │ ├── Environment-variables │ └── environment-variables.rb │ ├── Equilibrium-index │ ├── equilibrium-index-1.rb │ ├── equilibrium-index-2.rb │ ├── equilibrium-index-3.rb │ └── equilibrium-index-4.rb │ ├── Evaluate-binomial-coefficients │ ├── evaluate-binomial-coefficients-1.rb │ ├── evaluate-binomial-coefficients-2.rb │ └── evaluate-binomial-coefficients-3.rb │ ├── Even-or-odd │ ├── even-or-odd-1.rb │ └── even-or-odd-2.rb │ ├── Evolutionary-algorithm │ └── evolutionary-algorithm.rb │ ├── Exceptions │ ├── exceptions-1.rb │ ├── exceptions-2.rb │ ├── exceptions-3.rb │ ├── exceptions-4.rb │ ├── exceptions-5.rb │ └── exceptions-6.rb │ ├── Execute-a-system-command │ └── execute-a-system-command.rb │ ├── Factorial │ └── factorial.rb │ ├── Factors-of-an-integer │ ├── factors-of-an-integer-1.rb │ └── factors-of-an-integer-2.rb │ ├── Fibonacci-n-step-number-sequences │ ├── fibonacci-n-step-number-sequences-1.rb │ └── fibonacci-n-step-number-sequences-2.rb │ ├── Fibonacci-sequence │ ├── fibonacci-sequence-1.rb │ ├── fibonacci-sequence-2.rb │ ├── fibonacci-sequence-3.rb │ ├── fibonacci-sequence-4.rb │ ├── fibonacci-sequence-5.rb │ ├── fibonacci-sequence-6.rb │ ├── fibonacci-sequence-7.rb │ └── fibonacci-sequence-8.rb │ ├── File-input-output │ ├── file-input-output-1.rb │ ├── file-input-output-2.rb │ └── file-input-output-3.rb │ ├── File-modification-time │ └── file-modification-time.rb │ ├── File-size │ └── file-size.rb │ ├── Filter │ ├── filter-1.rb │ └── filter-2.rb │ ├── Find-limit-of-recursion │ ├── find-limit-of-recursion-1.rb │ └── find-limit-of-recursion-2.rb │ ├── Find-the-last-Sunday-of-each-month │ └── find-the-last-sunday-of-each-month.rb │ ├── Find-the-missing-permutation │ └── find-the-missing-permutation.rb │ ├── First-class-functions │ └── first-class-functions.rb │ ├── Flatten-a-list │ ├── flatten-a-list-1.rb │ └── flatten-a-list-2.rb │ ├── Floyds-triangle │ └── floyds-triangle.rb │ ├── Forest-fire │ └── forest-fire.rb │ ├── Formatted-numeric-output │ └── formatted-numeric-output.rb │ ├── Forward-difference │ ├── forward-difference-1.rb │ └── forward-difference-2.rb │ ├── Fractal-tree │ └── fractal-tree.rb │ ├── Function-composition │ └── function-composition.rb │ ├── Function-definition │ └── function-definition.rb │ ├── Generate-lower-case-ASCII-alphabet │ └── generate-lower-case-ascii-alphabet.rb │ ├── Generator-Exponential │ ├── generator-exponential-1.rb │ ├── generator-exponential-2.rb │ └── generator-exponential-3.rb │ ├── Generic-swap │ ├── generic-swap-1.rb │ ├── generic-swap-2.rb │ └── generic-swap-3.rb │ ├── Greatest-common-divisor │ ├── greatest-common-divisor-1.rb │ └── greatest-common-divisor-2.rb │ ├── Greatest-element-of-a-list │ └── greatest-element-of-a-list.rb │ ├── Greatest-subsequential-sum │ ├── greatest-subsequential-sum-1.rb │ ├── greatest-subsequential-sum-2.rb │ └── greatest-subsequential-sum-3.rb │ ├── Guess-the-number-With-feedback │ └── guess-the-number-with-feedback.rb │ ├── Guess-the-number │ └── guess-the-number.rb │ ├── HTTP │ ├── http-1.rb │ └── http-2.rb │ ├── Hailstone-sequence │ ├── hailstone-sequence-1.rb │ └── hailstone-sequence-2.rb │ ├── Happy-numbers │ ├── happy-numbers-1.rb │ ├── happy-numbers-2.rb │ ├── happy-numbers-3.rb │ └── happy-numbers-4.rb │ ├── Hash-from-two-arrays │ ├── hash-from-two-arrays-1.rb │ ├── hash-from-two-arrays-2.rb │ └── hash-from-two-arrays-3.rb │ ├── Hello-world-Graphical │ ├── hello-world-graphical-1.rb │ ├── hello-world-graphical-2.rb │ ├── hello-world-graphical-3.rb │ ├── hello-world-graphical-4.rb │ ├── hello-world-graphical-5.rb │ └── hello-world-graphical-6.rb │ ├── Hello-world-Line-printer │ └── hello-world-line-printer.rb │ ├── Hello-world-Standard-error │ ├── hello-world-standard-error-1.rb │ └── hello-world-standard-error-2.rb │ ├── Hello-world-Text │ ├── hello-world-text-1.rb │ ├── hello-world-text-2.rb │ ├── hello-world-text-3.rb │ ├── hello-world-text-4.rb │ └── hello-world-text-5.rb │ ├── Higher-order-functions │ ├── higher-order-functions-1.rb │ └── higher-order-functions-2.rb │ ├── Horners-rule-for-polynomial-evaluation │ └── horners-rule-for-polynomial-evaluation.rb │ ├── Huffman-coding │ └── huffman-coding.rb │ ├── IBAN │ └── iban.rb │ ├── Identity-matrix │ ├── identity-matrix-1.rb │ └── identity-matrix-2.rb │ ├── Increment-a-numerical-string │ └── increment-a-numerical-string.rb │ ├── Infinity │ ├── infinity-1.rb │ └── infinity-2.rb │ ├── Inheritance-Single │ └── inheritance-single.rb │ ├── Input-loop │ ├── input-loop-1.rb │ └── input-loop-2.rb │ ├── Integer-comparison │ ├── integer-comparison-1.rb │ ├── integer-comparison-2.rb │ └── integer-comparison-3.rb │ ├── JSON │ └── json.rb │ ├── Jensens-Device │ ├── jensens-device-1.rb │ ├── jensens-device-2.rb │ └── jensens-device-3.rb │ ├── Josephus-problem │ └── josephus-problem.rb │ ├── Kaprekar-numbers │ └── kaprekar-numbers.rb │ ├── Knapsack-problem-0-1 │ ├── knapsack-problem-0-1-1.rb │ └── knapsack-problem-0-1-2.rb │ ├── Knuth-shuffle │ ├── knuth-shuffle-1.rb │ └── knuth-shuffle-2.rb │ ├── LZW-compression │ └── lzw-compression.rb │ ├── Langtons-ant │ ├── langtons-ant-1.rb │ └── langtons-ant-2.rb │ ├── Largest-int-from-concatenated-ints │ ├── largest-int-from-concatenated-ints-1.rb │ ├── largest-int-from-concatenated-ints-2.rb │ └── largest-int-from-concatenated-ints-3.rb │ ├── Leap-year │ └── leap-year.rb │ ├── Least-common-multiple │ ├── least-common-multiple-1.rb │ └── least-common-multiple-2.rb │ ├── Letter-frequency │ ├── letter-frequency-1.rb │ └── letter-frequency-2.rb │ ├── Levenshtein-distance │ ├── levenshtein-distance-1.rb │ └── levenshtein-distance-2.rb │ ├── Literals-Integer │ └── literals-integer.rb │ ├── Literals-String │ ├── literals-string-1.rb │ ├── literals-string-2.rb │ └── literals-string-3.rb │ ├── Logical-operations │ └── logical-operations.rb │ ├── Long-multiplication │ └── long-multiplication.rb │ ├── Longest-increasing-subsequence │ └── longest-increasing-subsequence.rb │ ├── Look-and-say-sequence │ ├── look-and-say-sequence-1.rb │ ├── look-and-say-sequence-2.rb │ ├── look-and-say-sequence-3.rb │ ├── look-and-say-sequence-4.rb │ └── look-and-say-sequence-5.rb │ ├── Loop-over-multiple-arrays-simultaneously │ ├── loop-over-multiple-arrays-simultaneously-1.rb │ ├── loop-over-multiple-arrays-simultaneously-2.rb │ └── loop-over-multiple-arrays-simultaneously-3.rb │ ├── Loops-Break │ ├── loops-break-1.rb │ └── loops-break-2.rb │ ├── Loops-Continue │ ├── loops-continue-1.rb │ ├── loops-continue-2.rb │ └── loops-continue-3.rb │ ├── Loops-Do-while │ ├── loops-do-while-1.rb │ ├── loops-do-while-2.rb │ ├── loops-do-while-3.rb │ └── loops-do-while-4.rb │ ├── Loops-Downward-for │ └── loops-downward-for.rb │ ├── Loops-For-with-a-specified-step │ ├── loops-for-with-a-specified-step-1.rb │ ├── loops-for-with-a-specified-step-2.rb │ └── loops-for-with-a-specified-step-3.rb │ ├── Loops-For │ ├── loops-for-1.rb │ ├── loops-for-2.rb │ ├── loops-for-3.rb │ ├── loops-for-4.rb │ ├── loops-for-5.rb │ └── loops-for-6.rb │ ├── Loops-Foreach │ ├── loops-foreach-1.rb │ └── loops-foreach-2.rb │ ├── Loops-Infinite │ └── loops-infinite.rb │ ├── Loops-N-plus-one-half │ ├── loops-n-plus-one-half-1.rb │ └── loops-n-plus-one-half-2.rb │ ├── Loops-Nested │ ├── loops-nested-1.rb │ └── loops-nested-2.rb │ ├── Loops-While │ ├── loops-while-1.rb │ ├── loops-while-2.rb │ └── loops-while-3.rb │ ├── Luhn-test-of-credit-card-numbers │ └── luhn-test-of-credit-card-numbers.rb │ ├── Man-or-boy-test │ └── man-or-boy-test.rb │ ├── Mandelbrot-set │ ├── mandelbrot-set-1.rb │ └── mandelbrot-set-2.rb │ ├── Matrix-transposition │ ├── matrix-transposition-1.rb │ ├── matrix-transposition-2.rb │ └── matrix-transposition-3.rb │ ├── Menu │ └── menu.rb │ ├── Middle-three-digits │ ├── middle-three-digits-1.rb │ └── middle-three-digits-2.rb │ ├── Modular-inverse │ └── modular-inverse.rb │ ├── Monte-Carlo-methods │ └── monte-carlo-methods.rb │ ├── Monty-Hall-problem │ └── monty-hall-problem.rb │ ├── Mutual-recursion │ └── mutual-recursion.rb │ ├── N-queens-problem │ ├── n-queens-problem-1.rb │ ├── n-queens-problem-2.rb │ └── n-queens-problem-3.rb │ ├── Named-parameters │ ├── named-parameters-1.rb │ ├── named-parameters-2.rb │ └── named-parameters-3.rb │ ├── Non-decimal-radices-Convert │ └── non-decimal-radices-convert.rb │ ├── Non-decimal-radices-Input │ ├── non-decimal-radices-input-1.rb │ ├── non-decimal-radices-input-2.rb │ ├── non-decimal-radices-input-3.rb │ ├── non-decimal-radices-input-4.rb │ └── non-decimal-radices-input-5.rb │ ├── Non-decimal-radices-Output │ └── non-decimal-radices-output.rb │ ├── Nth-root │ └── nth-root.rb │ ├── Nth │ └── nth.rb │ ├── Null-object │ └── null-object.rb │ ├── Number-reversal-game │ └── number-reversal-game.rb │ ├── Palindrome-detection │ ├── palindrome-detection-1.rb │ ├── palindrome-detection-2.rb │ └── palindrome-detection-3.rb │ ├── Pangram-checker │ └── pangram-checker.rb │ ├── Parsing-RPN-calculator-algorithm │ └── parsing-rpn-calculator-algorithm.rb │ ├── Pascals-triangle │ ├── pascals-triangle-1.rb │ └── pascals-triangle-2.rb │ ├── Perfect-numbers │ ├── perfect-numbers-1.rb │ ├── perfect-numbers-2.rb │ ├── perfect-numbers-3.rb │ ├── perfect-numbers-4.rb │ └── perfect-numbers-5.rb │ ├── Permutations │ └── permutations.rb │ ├── Phrase-reversals │ └── phrase-reversals.rb │ ├── Pick-random-element │ └── pick-random-element.rb │ ├── Playing-cards │ └── playing-cards.rb │ ├── Polymorphic-copy │ └── polymorphic-copy.rb │ ├── Polymorphism │ ├── polymorphism-1.rb │ └── polymorphism-2.rb │ ├── Power-set │ └── power-set.rb │ ├── Primality-by-trial-division │ ├── primality-by-trial-division-1.rb │ ├── primality-by-trial-division-2.rb │ ├── primality-by-trial-division-3.rb │ └── primality-by-trial-division-4.rb │ ├── Program-name │ └── program-name.rb │ ├── Program-termination │ ├── program-termination-1.rb │ └── program-termination-2.rb │ ├── Queue-Definition │ ├── queue-definition-1.rb │ └── queue-definition-2.rb │ ├── Quine │ ├── quine-1.rb │ ├── quine-2.rb │ ├── quine-3.rb │ ├── quine-4.rb │ └── quine-5.rb │ ├── Random-numbers │ └── random-numbers.rb │ ├── Range-expansion │ └── range-expansion.rb │ ├── Read-a-file-line-by-line │ ├── read-a-file-line-by-line-1.rb │ ├── read-a-file-line-by-line-2.rb │ ├── read-a-file-line-by-line-3.rb │ └── read-a-file-line-by-line-4.rb │ ├── Read-entire-file │ ├── read-entire-file-1.rb │ ├── read-entire-file-2.rb │ ├── read-entire-file-3.rb │ └── read-entire-file-4.rb │ ├── Real-constants-and-functions │ └── real-constants-and-functions.rb │ ├── Reduced-row-echelon-form │ └── reduced-row-echelon-form.rb │ ├── Regular-expressions │ ├── regular-expressions-1.rb │ ├── regular-expressions-2.rb │ └── regular-expressions-3.rb │ ├── Remove-duplicate-elements │ ├── remove-duplicate-elements-1.rb │ ├── remove-duplicate-elements-2.rb │ └── remove-duplicate-elements-3.rb │ ├── Rename-a-file │ ├── rename-a-file-1.rb │ └── rename-a-file-2.rb │ ├── Repeat-a-string │ └── repeat-a-string.rb │ ├── Return-multiple-values │ ├── return-multiple-values-1.rb │ ├── return-multiple-values-2.rb │ └── return-multiple-values-3.rb │ ├── Reverse-a-string │ ├── reverse-a-string-1.rb │ └── reverse-a-string-2.rb │ ├── Reverse-words-in-a-string │ └── reverse-words-in-a-string.rb │ ├── Roman-numerals-Decode │ ├── roman-numerals-decode-1.rb │ └── roman-numerals-decode-2.rb │ ├── Roman-numerals-Encode │ ├── roman-numerals-encode-1.rb │ ├── roman-numerals-encode-2.rb │ └── roman-numerals-encode-3.rb │ ├── Rot-13 │ └── rot-13.rb │ ├── Run-length-encoding │ ├── run-length-encoding-1.rb │ ├── run-length-encoding-2.rb │ ├── run-length-encoding-3.rb │ ├── run-length-encoding-4.rb │ └── run-length-encoding-5.rb │ ├── SEDOLs │ └── sedols.rb │ ├── Search-a-list │ ├── search-a-list-1.rb │ ├── search-a-list-2.rb │ └── search-a-list-3.rb │ ├── Self-describing-numbers │ └── self-describing-numbers.rb │ ├── Semordnilap │ ├── semordnilap-1.rb │ └── semordnilap-2.rb │ ├── Sequence-of-non-squares │ └── sequence-of-non-squares.rb │ ├── Show-the-epoch │ └── show-the-epoch.rb │ ├── Sieve-of-Eratosthenes │ ├── sieve-of-eratosthenes-1.rb │ ├── sieve-of-eratosthenes-2.rb │ ├── sieve-of-eratosthenes-3.rb │ └── sieve-of-eratosthenes-4.rb │ ├── Singleton │ └── singleton.rb │ ├── Sleep │ └── sleep.rb │ ├── Sort-an-integer-array │ └── sort-an-integer-array.rb │ ├── Sort-using-a-custom-comparator │ ├── sort-using-a-custom-comparator-1.rb │ └── sort-using-a-custom-comparator-2.rb │ ├── Sorting-algorithms-Bogosort │ ├── sorting-algorithms-bogosort-1.rb │ ├── sorting-algorithms-bogosort-2.rb │ └── sorting-algorithms-bogosort-3.rb │ ├── Sorting-algorithms-Bubble-sort │ └── sorting-algorithms-bubble-sort.rb │ ├── Sorting-algorithms-Cocktail-sort │ ├── sorting-algorithms-cocktail-sort-1.rb │ ├── sorting-algorithms-cocktail-sort-2.rb │ └── sorting-algorithms-cocktail-sort-3.rb │ ├── Sorting-algorithms-Comb-sort │ └── sorting-algorithms-comb-sort.rb │ ├── Sorting-algorithms-Counting-sort │ └── sorting-algorithms-counting-sort.rb │ ├── Sorting-algorithms-Gnome-sort │ └── sorting-algorithms-gnome-sort.rb │ ├── Sorting-algorithms-Insertion-sort │ ├── sorting-algorithms-insertion-sort-1.rb │ └── sorting-algorithms-insertion-sort-2.rb │ ├── Sorting-algorithms-Merge-sort │ ├── sorting-algorithms-merge-sort-1.rb │ └── sorting-algorithms-merge-sort-2.rb │ ├── Sorting-algorithms-Quicksort │ ├── sorting-algorithms-quicksort-1.rb │ ├── sorting-algorithms-quicksort-2.rb │ └── sorting-algorithms-quicksort-3.rb │ ├── Sorting-algorithms-Selection-sort │ └── sorting-algorithms-selection-sort.rb │ ├── Sorting-algorithms-Shell-sort │ └── sorting-algorithms-shell-sort.rb │ ├── Sorting-algorithms-Stooge-sort │ └── sorting-algorithms-stooge-sort.rb │ ├── Stack │ ├── stack-1.rb │ ├── stack-2.rb │ └── stack-3.rb │ ├── String-case │ ├── string-case-1.rb │ └── string-case-2.rb │ ├── String-concatenation │ └── string-concatenation.rb │ ├── String-interpolation--included- │ └── string-interpolation--included-.rb │ ├── String-length │ ├── string-length-1.rb │ ├── string-length-2.rb │ ├── string-length-3.rb │ ├── string-length-4.rb │ ├── string-length-5.rb │ └── string-length-6.rb │ ├── String-matching │ └── string-matching.rb │ ├── Strip-a-set-of-characters-from-a-string │ └── strip-a-set-of-characters-from-a-string.rb │ ├── Strip-whitespace-from-a-string-Top-and-tail │ └── strip-whitespace-from-a-string-top-and-tail.rb │ ├── Substring-Top-and-tail │ └── substring-top-and-tail.rb │ ├── Substring │ └── substring.rb │ ├── Sudoku │ └── sudoku.rb │ ├── Sum-and-product-of-an-array │ ├── sum-and-product-of-an-array-1.rb │ ├── sum-and-product-of-an-array-2.rb │ ├── sum-and-product-of-an-array-3.rb │ └── sum-and-product-of-an-array-4.rb │ ├── Sum-digits-of-an-integer │ ├── sum-digits-of-an-integer-1.rb │ └── sum-digits-of-an-integer-2.rb │ ├── Sum-of-a-series │ └── sum-of-a-series.rb │ ├── Sum-of-squares │ ├── sum-of-squares-1.rb │ └── sum-of-squares-2.rb │ ├── Symmetric-difference │ ├── symmetric-difference-1.rb │ └── symmetric-difference-2.rb │ ├── System-time │ └── system-time.rb │ ├── Take-notes-on-the-command-line │ └── take-notes-on-the-command-line.rb │ ├── Temperature-conversion │ ├── temperature-conversion-1.rb │ └── temperature-conversion-2.rb │ ├── Ternary-logic │ ├── ternary-logic-1.rb │ ├── ternary-logic-2.rb │ └── ternary-logic-3.rb │ ├── Text-processing-2 │ └── text-processing-2.rb │ ├── Text-processing-Max-licenses-in-use │ └── text-processing-max-licenses-in-use.rb │ ├── The-Twelve-Days-of-Christmas │ └── the-twelve-days-of-christmas.rb │ ├── Tokenize-a-string │ └── tokenize-a-string.rb │ ├── Top-rank-per-group │ └── top-rank-per-group.rb │ ├── Towers-of-Hanoi │ ├── towers-of-hanoi-1.rb │ └── towers-of-hanoi-2.rb │ ├── Tree-traversal │ └── tree-traversal.rb │ ├── Trigonometric-functions │ ├── trigonometric-functions-1.rb │ └── trigonometric-functions-2.rb │ ├── URL-decoding │ ├── url-decoding-1.rb │ └── url-decoding-2.rb │ ├── URL-encoding │ ├── url-encoding-1.rb │ └── url-encoding-2.rb │ ├── Unix-ls │ └── unix-ls.rb │ ├── User-input-Text │ └── user-input-text.rb │ ├── Variadic-function │ ├── variadic-function-1.rb │ ├── variadic-function-2.rb │ └── variadic-function-3.rb │ ├── Vector-products │ └── vector-products.rb │ ├── Vigen-re-cipher │ ├── vigen-re-cipher-1.rb │ └── vigen-re-cipher-2.rb │ ├── Walk-a-directory-Non-recursively │ └── walk-a-directory-non-recursively.rb │ ├── Walk-a-directory-Recursively │ ├── walk-a-directory-recursively-1.rb │ └── walk-a-directory-recursively-2.rb │ ├── Web-scraping │ ├── web-scraping-1.rb │ └── web-scraping-2.rb │ ├── XML-Input │ └── xml-input.rb │ ├── XML-XPath │ └── xml-xpath.rb │ ├── Y-combinator │ ├── y-combinator-1.rb │ ├── y-combinator-2.rb │ ├── y-combinator-3.rb │ └── y-combinator-4.rb │ ├── Zeckendorf-number-representation │ ├── zeckendorf-number-representation-1.rb │ └── zeckendorf-number-representation-2.rb │ ├── Zero-to-the-zero-power │ └── zero-to-the-zero-power.rb │ └── Zig-zag-matrix │ └── zig-zag-matrix.rb └── training_data ├── .keep ├── README.md └── rosettaJavaCorpus.src /code_embeddings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waingram/code-embeddings/8c656a918be4a0cad035bff8144d93892c677a24/code_embeddings/__init__.py -------------------------------------------------------------------------------- /experiments/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waingram/code-embeddings/8c656a918be4a0cad035bff8144d93892c677a24/experiments/__init__.py -------------------------------------------------------------------------------- /test_data/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waingram/code-embeddings/8c656a918be4a0cad035bff8144d93892c677a24/test_data/.keep -------------------------------------------------------------------------------- /test_data/C++/Accumulator-factory/accumulator-factory-6.cpp: -------------------------------------------------------------------------------- 1 | std::ostream& operator<<(std::ostream& dst, const Accumulator_& acc) 2 | { 3 | return acc.val_->Write(dst); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-2.cpp: -------------------------------------------------------------------------------- 1 | std::map exampleMap 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-3.cpp: -------------------------------------------------------------------------------- 1 | std::map exampleMap 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-4.cpp: -------------------------------------------------------------------------------- 1 | exampleMap[7] = 3.14 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-5.cpp: -------------------------------------------------------------------------------- 1 | int myKey = 7; 2 | double myValue = 3.14; 3 | exampleMap[myKey] = myValue; 4 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-6.cpp: -------------------------------------------------------------------------------- 1 | exampleMap.insert(std::pair(7,3.14)); 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-7.cpp: -------------------------------------------------------------------------------- 1 | exampleMap.insert(std::make_pair(7,3.14)); 2 | -------------------------------------------------------------------------------- /test_data/C++/Associative-array-Creation/associative-array-creation-8.cpp: -------------------------------------------------------------------------------- 1 | myValue = exampleMap[myKey] 2 | -------------------------------------------------------------------------------- /test_data/C++/Binary-search/binary-search-3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /test_data/C++/Binary-search/binary-search-4.cpp: -------------------------------------------------------------------------------- 1 | int *ptr = std::lower_bound(array, array+len, what); // a custom comparator can be given as fourth arg 2 | -------------------------------------------------------------------------------- /test_data/C++/Binary-search/binary-search-5.cpp: -------------------------------------------------------------------------------- 1 | int *ptr = std::upper_bound(array, array+len, what); // a custom comparator can be given as fourth arg 2 | -------------------------------------------------------------------------------- /test_data/C++/Binary-search/binary-search-6.cpp: -------------------------------------------------------------------------------- 1 | std::pair bounds = std::equal_range(array, array+len, what); // a custom comparator can be given as fourth arg 2 | -------------------------------------------------------------------------------- /test_data/C++/Binary-search/binary-search-7.cpp: -------------------------------------------------------------------------------- 1 | bool found = std::binary_search(array, array+len, what); // a custom comparator can be given as fourth arg 2 | -------------------------------------------------------------------------------- /test_data/C++/Call-an-object-method/call-an-object-method.cpp: -------------------------------------------------------------------------------- 1 | // Static 2 | MyClass::method(someParameter); 3 | 4 | // Instance 5 | myInstance.method(someParameter); 6 | -------------------------------------------------------------------------------- /test_data/C++/Classes/classes-2.cpp: -------------------------------------------------------------------------------- 1 | class MyClass 2 | { 3 | public: 4 | MyClass(): variable(0) {} 5 | void someMethod() { variable = 1; } 6 | private: 7 | int variable; 8 | }; 9 | -------------------------------------------------------------------------------- /test_data/C++/Classes/classes-3.cpp: -------------------------------------------------------------------------------- 1 | class MyClass 2 | { 3 | public: 4 | virtual void someMethod(); // this is polymorphic 5 | virtual ~MyClass(); // destructor 6 | }; 7 | -------------------------------------------------------------------------------- /test_data/C++/Comments/comments-1.cpp: -------------------------------------------------------------------------------- 1 | // This is a comment 2 | -------------------------------------------------------------------------------- /test_data/C++/Comments/comments-2.cpp: -------------------------------------------------------------------------------- 1 | // This is a valid comment // with a "nested" comment 2 | -------------------------------------------------------------------------------- /test_data/C++/Comments/comments-3.cpp: -------------------------------------------------------------------------------- 1 | #define FOO \ 2 | (macro text) // comment 3 | (no more macro text) 4 | -------------------------------------------------------------------------------- /test_data/C++/Compound-data-type/compound-data-type-1.cpp: -------------------------------------------------------------------------------- 1 | struct Point 2 | { 3 | int x; 4 | int y; 5 | }; 6 | -------------------------------------------------------------------------------- /test_data/C++/Compound-data-type/compound-data-type-2.cpp: -------------------------------------------------------------------------------- 1 | struct Point 2 | { 3 | int x; 4 | int y; 5 | Point(int ax, int ay): x(ax), y(ax) {} 6 | }; 7 | -------------------------------------------------------------------------------- /test_data/C++/Enumerations/enumerations-1.cpp: -------------------------------------------------------------------------------- 1 | enum fruits { apple, banana, cherry }; 2 | 3 | enum fruits { apple = 0, banana = 1, cherry = 2 }; 4 | -------------------------------------------------------------------------------- /test_data/C++/Enumerations/enumerations-2.cpp: -------------------------------------------------------------------------------- 1 | enum class fruits { apple, banana, cherry }; 2 | 3 | enum class fruits { apple = 0, banana = 1, cherry = 2 }; 4 | -------------------------------------------------------------------------------- /test_data/C++/Enumerations/enumerations-3.cpp: -------------------------------------------------------------------------------- 1 | enum class fruits : unsigned int { apple, banana, cherry }; 2 | -------------------------------------------------------------------------------- /test_data/C++/Enumerations/enumerations-4.cpp: -------------------------------------------------------------------------------- 1 | enum fruits : unsigned int { apple, banana, cherry }; 2 | -------------------------------------------------------------------------------- /test_data/C++/Environment-variables/environment-variables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | puts(getenv("HOME")); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test_data/C++/Even-or-odd/even-or-odd-1.cpp: -------------------------------------------------------------------------------- 1 | bool isOdd(int x) 2 | { 3 | return x % 2; 4 | } 5 | 6 | bool isEven(int x) 7 | { 8 | return !(x % 2); 9 | } 10 | -------------------------------------------------------------------------------- /test_data/C++/Exceptions/exceptions-1.cpp: -------------------------------------------------------------------------------- 1 | struct MyException 2 | { 3 | // data with info about exception 4 | }; 5 | -------------------------------------------------------------------------------- /test_data/C++/Exceptions/exceptions-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | struct MyException: std::exception 3 | { 4 | char const* what() const throw() { return "description"; } 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Execute-a-system-command/execute-a-system-command.cpp: -------------------------------------------------------------------------------- 1 | system("pause"); 2 | -------------------------------------------------------------------------------- /test_data/C++/Function-definition/function-definition-1.cpp: -------------------------------------------------------------------------------- 1 | inline double multiply(double a, double b) 2 | { 3 | return a*b; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Function-definition/function-definition-2.cpp: -------------------------------------------------------------------------------- 1 | template 2 | Number multiply(Number a, Number b) 3 | { 4 | return a*b; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Generic-swap/generic-swap-1.cpp: -------------------------------------------------------------------------------- 1 | template void swap(T& left, T& right) 2 | { 3 | T tmp(left); 4 | left = right; 5 | right = tmp; 6 | } 7 | -------------------------------------------------------------------------------- /test_data/C++/Generic-swap/generic-swap-2.cpp: -------------------------------------------------------------------------------- 1 | std::swap(x,y); 2 | -------------------------------------------------------------------------------- /test_data/C++/Generic-swap/generic-swap-3.cpp: -------------------------------------------------------------------------------- 1 | template 2 | void swap(T &lhs, T &rhs){ 3 | T tmp = std::move(lhs); 4 | lhs = std::move(rhs); 5 | rhs = std::move(tmp); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/C++/HTTP/http-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace Upp; 4 | 5 | CONSOLE_APP_MAIN 6 | { 7 | Cout() << HttpClient("www.rosettacode.org").ExecuteRedirect(); 8 | } 9 | -------------------------------------------------------------------------------- /test_data/C++/Hello-world-Graphical/hello-world-graphical-2.cpp: -------------------------------------------------------------------------------- 1 | #include "afx.h" 2 | void ShowGoodbyeWorld(CWnd* pWnd) 3 | { 4 | pWnd->SetWindowText(_T("Goodbye, World!")); 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Hello-world-Standard-error/hello-world-standard-error.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | std::cerr << "Goodbye, World!\n"; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Hello-world-Text/hello-world-text.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main () { 4 | std::cout << "Hello world!" << std::endl; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Increment-a-numerical-string/increment-a-numerical-string-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | std::string s = "12345"; 4 | s = std::to_string(1+std::stoi(s)); 5 | -------------------------------------------------------------------------------- /test_data/C++/Increment-a-numerical-string/increment-a-numerical-string-4.cpp: -------------------------------------------------------------------------------- 1 | // Qt 2 | QString num1 = "12345"; 3 | QString num2 = QString("%1").arg(v1.toInt()+1); 4 | -------------------------------------------------------------------------------- /test_data/C++/Literals-String/literals-string.cpp: -------------------------------------------------------------------------------- 1 | auto strA = R"(this is 2 | a newline-separated 3 | raw string)"; 4 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Do-while/loops-do-while.cpp: -------------------------------------------------------------------------------- 1 | int val = 0; 2 | do{ 3 | val++; 4 | std::cout << val << std::endl; 5 | }while(val % 6 != 0); 6 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Downward-for/loops-downward-for.cpp: -------------------------------------------------------------------------------- 1 | for(int i = 10; i >= 0; --i) 2 | std::cout << i << "\n"; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-For-with-a-specified-step/loops-for-with-a-specified-step.cpp: -------------------------------------------------------------------------------- 1 | for (int i = 1; i < 10; i += 2) 2 | std::cout << i << std::endl; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-For/loops-for.cpp: -------------------------------------------------------------------------------- 1 | for(int i = 1; i <= 5; ++i) { 2 | for(int j = 1; j <= i; j++) 3 | std::cout << "*"; 4 | std::cout << std::endl; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Foreach/loops-foreach-1.cpp: -------------------------------------------------------------------------------- 1 | for (container_type::iterator i = container.begin(); i != container.end(); ++i) 2 | { 3 | std::cout << *i << "\n"; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Foreach/loops-foreach-2.cpp: -------------------------------------------------------------------------------- 1 | std::copy(container.begin(), container.end(), 2 | std::ostream_iterator(std::cout, "\n")); 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Foreach/loops-foreach-4.cpp: -------------------------------------------------------------------------------- 1 | for (auto element: container) 2 | { 3 | std::cout << element << "\n"; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Foreach/loops-foreach-5.cpp: -------------------------------------------------------------------------------- 1 | for (auto const& element: container) 2 | { 3 | std::cout << element << "\n"; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Foreach/loops-foreach-6.cpp: -------------------------------------------------------------------------------- 1 | for (auto&& element: container) //use a 'universal reference' 2 | { 3 | element += 42; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Infinite/loops-infinite-1.cpp: -------------------------------------------------------------------------------- 1 | while (true) 2 | std::cout << "SPAM" << std::endl; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Infinite/loops-infinite-2.cpp: -------------------------------------------------------------------------------- 1 | for (;;) 2 | std::cout << "SPAM" << std::endl; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-Infinite/loops-infinite-3.cpp: -------------------------------------------------------------------------------- 1 | do 2 | std::cout << "SPAM" << std::endl; 3 | while (true); 4 | -------------------------------------------------------------------------------- /test_data/C++/Loops-While/loops-while-1.cpp: -------------------------------------------------------------------------------- 1 | int i = 1024; 2 | while(i > 0) { 3 | std::cout << i << std::endl; 4 | i /= 2; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Loops-While/loops-while-2.cpp: -------------------------------------------------------------------------------- 1 | for (int i = 1024; i>0; i /= 2) 2 | std::cout << i << std::endl; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-While/loops-while-3.cpp: -------------------------------------------------------------------------------- 1 | for (init; cond; update) 2 | statement; 3 | -------------------------------------------------------------------------------- /test_data/C++/Loops-While/loops-while-4.cpp: -------------------------------------------------------------------------------- 1 | { 2 | init; 3 | while (cond) 4 | { 5 | statement; 6 | update; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test_data/C++/Named-parameters/named-parameters-2.cpp: -------------------------------------------------------------------------------- 1 | void foo(foo_params p){ . . .} 2 | -------------------------------------------------------------------------------- /test_data/C++/Named-parameters/named-parameters-3.cpp: -------------------------------------------------------------------------------- 1 | foo(foo_params(42).x(7).z(23.54)); 2 | -------------------------------------------------------------------------------- /test_data/C++/Nth-root/nth-root-2.cpp: -------------------------------------------------------------------------------- 1 | double NthRoot(double value, double degree) 2 | { 3 | return pow(value, (double)(1 / degree)); 4 | }; 5 | -------------------------------------------------------------------------------- /test_data/C++/Null-object/null-object-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | if (object == 0) { 4 | std::cout << "object is null"; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/C++/Null-object/null-object-3.cpp: -------------------------------------------------------------------------------- 1 | int *p = nullptr; 2 | ... 3 | if (p == nullptr){ 4 | // do some thing 5 | } 6 | //or just 7 | if (p){ 8 | // do some thing 9 | } 10 | -------------------------------------------------------------------------------- /test_data/C++/Program-termination/program-termination-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void problem_occured() 4 | { 5 | std::exit(EXIT_FAILURE); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/C++/Program-termination/program-termination-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void problem_occured() 4 | { 5 | std::abort(); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/C++/Program-termination/program-termination-3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void problem_occured() 4 | { 5 | std::terminate(); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/C++/Quine/quine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){char n[]=R"(#include 3 | int main(){char n[]=R"(%s%c";printf(n,n,41);})";printf(n,n,41);} 4 | -------------------------------------------------------------------------------- /test_data/C++/Stack/stack-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /test_data/C++/User-input-Text/user-input-text-2.cpp: -------------------------------------------------------------------------------- 1 | cin >> string_input; 2 | -------------------------------------------------------------------------------- /test_data/C++/User-input-Text/user-input-text-3.cpp: -------------------------------------------------------------------------------- 1 | getline(cin, string_input); 2 | -------------------------------------------------------------------------------- /test_data/Java/Associative-array-Creation/associative-array-creation-3.java: -------------------------------------------------------------------------------- 1 | map.get("foo"); // => 6 2 | map.get("invalid"); // => null 3 | -------------------------------------------------------------------------------- /test_data/Java/Associative-array-Creation/associative-array-creation-4.java: -------------------------------------------------------------------------------- 1 | for (String key: map.keySet()) 2 | System.out.println(key); 3 | -------------------------------------------------------------------------------- /test_data/Java/Associative-array-Creation/associative-array-creation-5.java: -------------------------------------------------------------------------------- 1 | for (int value: map.values()) 2 | System.out.println(value); 3 | -------------------------------------------------------------------------------- /test_data/Java/Bitwise-operations/bitwise-operations-2.java: -------------------------------------------------------------------------------- 1 | a <<= 3; 2 | a = a << 3; 3 | a *= 8; //2 * 2 * 2 = 8 4 | a = a * 8; 5 | -------------------------------------------------------------------------------- /test_data/Java/Call-an-object-method/call-an-object-method-1.java: -------------------------------------------------------------------------------- 1 | ClassWithStaticMethod.staticMethodName(argument1, argument2);//for methods with no arguments, use empty parentheses 2 | -------------------------------------------------------------------------------- /test_data/Java/Classes/classes-2.java: -------------------------------------------------------------------------------- 1 | new MyClass(); 2 | -------------------------------------------------------------------------------- /test_data/Java/Collections/collections-2.java: -------------------------------------------------------------------------------- 1 | //loop through myarrlist to sum each entry 2 | for ( i = 0; i < myarrlist.size(); i++) { 3 | sum += myarrlist.get(i); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/Java/Collections/collections-3.java: -------------------------------------------------------------------------------- 1 | for(int i : myarrlist) { 2 | sum += i; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Collections/collections-4.java: -------------------------------------------------------------------------------- 1 | //remove the last entry in the ArrayList 2 | myarrlist.remove(myarrlist.size()-1) 3 | 4 | //clear the ArrayList 5 | myarrlist.clear(); 6 | -------------------------------------------------------------------------------- /test_data/Java/Comments/comments-1.java: -------------------------------------------------------------------------------- 1 | /* This is a comment */ 2 | -------------------------------------------------------------------------------- /test_data/Java/Comments/comments-2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is 3 | * a multiple 4 | * line comment. 5 | */ 6 | -------------------------------------------------------------------------------- /test_data/Java/Comments/comments-3.java: -------------------------------------------------------------------------------- 1 | // This is a comment 2 | -------------------------------------------------------------------------------- /test_data/Java/Comments/comments-4.java: -------------------------------------------------------------------------------- 1 | /** This is a Javadoc comment */ 2 | -------------------------------------------------------------------------------- /test_data/Java/Comments/comments-5.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This is 3 | * a multiple 4 | * line Javadoc comment 5 | */ 6 | -------------------------------------------------------------------------------- /test_data/Java/Copy-a-string/copy-a-string-2.java: -------------------------------------------------------------------------------- 1 | StringBuffer srcCopy = new StringBuffer("Hello"); 2 | -------------------------------------------------------------------------------- /test_data/Java/Delegates/delegates-2.java: -------------------------------------------------------------------------------- 1 | package delegate; 2 | 3 | @FunctionalInterface 4 | public interface Thingable { 5 | public String thing(); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/Java/Detect-division-by-zero/detect-division-by-zero-1.java: -------------------------------------------------------------------------------- 1 | public static boolean infinity(double numer, double denom){ 2 | return Double.isInfinite(numer/denom); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Enumerations/enumerations-1.java: -------------------------------------------------------------------------------- 1 | enum Fruits{ 2 | APPLE, BANANA, CHERRY 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Environment-variables/environment-variables.java: -------------------------------------------------------------------------------- 1 | System.getenv("HOME") // get env var 2 | System.getenv() // get the entire environment as a Map of keys to values 3 | -------------------------------------------------------------------------------- /test_data/Java/Even-or-odd/even-or-odd-1.java: -------------------------------------------------------------------------------- 1 | public static boolean isEven(int i){ 2 | return (i & 1) == 0; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Even-or-odd/even-or-odd-2.java: -------------------------------------------------------------------------------- 1 | public static boolean isEven(int i){ 2 | return (i % 2) == 0; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Even-or-odd/even-or-odd-3.java: -------------------------------------------------------------------------------- 1 | public static boolean isEven(BigInteger i){ 2 | return i.and(BigInteger.ONE).equals(BigInteger.ZERO); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Even-or-odd/even-or-odd-4.java: -------------------------------------------------------------------------------- 1 | public static boolean isEven(BigInteger i){ 2 | return !i.testBit(0); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Even-or-odd/even-or-odd-5.java: -------------------------------------------------------------------------------- 1 | public static boolean isEven(BigInteger i){ 2 | return i.mod(BigInteger.valueOf(2)).equals(BigInteger.ZERO); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Fibonacci-sequence/fibonacci-sequence-3.java: -------------------------------------------------------------------------------- 1 | public static long recFibN(final int n) 2 | { 3 | return (n < 2) ? n : recFibN(n - 1) + recFibN(n - 2); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/Java/Hello-world-Text/hello-world-text.java: -------------------------------------------------------------------------------- 1 | public class HelloWorld 2 | { 3 | public static void main(String[] args) 4 | { 5 | System.out.println("Hello world!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test_data/Java/Increment-a-numerical-string/increment-a-numerical-string-1.java: -------------------------------------------------------------------------------- 1 | String s = "12345"; 2 | s = String.valueOf(Integer.parseInt(s) + 1); 3 | -------------------------------------------------------------------------------- /test_data/Java/Increment-a-numerical-string/increment-a-numerical-string-2.java: -------------------------------------------------------------------------------- 1 | String s = "123456789012345678901234567890.12345"; 2 | s = new BigDecimal(s).add(BigDecimal.ONE).toString(); 3 | -------------------------------------------------------------------------------- /test_data/Java/Infinity/infinity-1.java: -------------------------------------------------------------------------------- 1 | double infinity = Double.POSITIVE_INFINITY; //defined as 1.0/0.0 2 | Double.isInfinite(infinity); //true 3 | -------------------------------------------------------------------------------- /test_data/Java/Infinity/infinity-2.java: -------------------------------------------------------------------------------- 1 | public static double getInf(){ 2 | return Double.POSITIVE_INFINITY; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Infinity/infinity-3.java: -------------------------------------------------------------------------------- 1 | double biggestNumber = Double.MAX_VALUE; 2 | -------------------------------------------------------------------------------- /test_data/Java/Inheritance-Single/inheritance-single-1.java: -------------------------------------------------------------------------------- 1 | public class Animal{ 2 | //functions go here... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Inheritance-Single/inheritance-single-2.java: -------------------------------------------------------------------------------- 1 | public class Dog extends Animal{ 2 | //functions go here... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Inheritance-Single/inheritance-single-3.java: -------------------------------------------------------------------------------- 1 | public class Cat extends Animal{ 2 | //functions go here... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Inheritance-Single/inheritance-single-4.java: -------------------------------------------------------------------------------- 1 | public class Lab extends Dog{ 2 | //functions go here... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Inheritance-Single/inheritance-single-5.java: -------------------------------------------------------------------------------- 1 | public class Collie extends Dog{ 2 | //functions go here... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/LZW-compression/lzw-compression-2.java: -------------------------------------------------------------------------------- 1 | [84, 79, 66, 69, 79, 82, 78, 79, 84, 256, 258, 260, 265, 259, 261, 263] 2 | TOBEORNOTTOBEORTOBEORNOT 3 | -------------------------------------------------------------------------------- /test_data/Java/Loops-Do-while/loops-do-while.java: -------------------------------------------------------------------------------- 1 | int val = 0; 2 | do{ 3 | val++; 4 | System.out.println(val); 5 | }while(val % 6 != 0); 6 | -------------------------------------------------------------------------------- /test_data/Java/Loops-Downward-for/loops-downward-for.java: -------------------------------------------------------------------------------- 1 | for(i = 10; i >= 0; --i){ 2 | System.out.println(i); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Loops-For/loops-for.java: -------------------------------------------------------------------------------- 1 | for (int i = 0; i < 5; i++) { 2 | for (int j = 0; j <= i; j++) { 3 | System.out.print("*"); 4 | } 5 | System.out.println(); 6 | } 7 | -------------------------------------------------------------------------------- /test_data/Java/Loops-Foreach/loops-foreach.java: -------------------------------------------------------------------------------- 1 | Iterable collect; 2 | ... 3 | for(Type i:collect){ 4 | System.out.println(i); 5 | } 6 | -------------------------------------------------------------------------------- /test_data/Java/Loops-Infinite/loops-infinite-1.java: -------------------------------------------------------------------------------- 1 | while(true){ 2 | System.out.println("SPAM"); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Loops-Infinite/loops-infinite-2.java: -------------------------------------------------------------------------------- 1 | for(;;){ 2 | System.out.println("SPAM"); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Loops-While/loops-while-1.java: -------------------------------------------------------------------------------- 1 | int i = 1024; 2 | while(i > 0){ 3 | System.out.println(i); 4 | i >>= 1; //also acceptable: i /= 2; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/Java/Loops-While/loops-while-2.java: -------------------------------------------------------------------------------- 1 | for(int i = 1024; i > 0;i /= 2 /*or i>>= 1*/){ 2 | System.out.println(i); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Modular-inverse/modular-inverse.java: -------------------------------------------------------------------------------- 1 | System.out.println(BigInteger.valueOf(42).modInverse(BigInteger.valueOf(2017))); 2 | -------------------------------------------------------------------------------- /test_data/Java/Named-parameters/named-parameters.java: -------------------------------------------------------------------------------- 1 | processNutritionFacts(new NutritionFacts.Builder(240, 8).calories(100).sodium(35).carbohydrate(27).build()); 2 | -------------------------------------------------------------------------------- /test_data/Java/Non-decimal-radices-Input/non-decimal-radices-input-2.java: -------------------------------------------------------------------------------- 1 | int number = Integer.parseInt(stringNum, base); 2 | -------------------------------------------------------------------------------- /test_data/Java/Null-object/null-object.java: -------------------------------------------------------------------------------- 1 | // here "object" is a reference 2 | if (object == null) { 3 | System.out.println("object is null"); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/Java/Playing-cards/playing-cards-1.java: -------------------------------------------------------------------------------- 1 | public enum Pip { Two, Three, Four, Five, Six, Seven, 2 | Eight, Nine, Ten, Jack, Queen, King, Ace } 3 | -------------------------------------------------------------------------------- /test_data/Java/Playing-cards/playing-cards-2.java: -------------------------------------------------------------------------------- 1 | public enum Suit { Diamonds, Spades, Hearts, Clubs } 2 | -------------------------------------------------------------------------------- /test_data/Java/Primality-by-trial-division/primality-by-trial-division-2.java: -------------------------------------------------------------------------------- 1 | public static boolean prime(int n) { 2 | return !new String(new char[n]).matches(".?|(..+?)\\1+"); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Read-entire-file/read-entire-file-3.java: -------------------------------------------------------------------------------- 1 | String content = new Scanner(new File("foo"), "UTF-8").useDelimiter("\\A").next(); 2 | -------------------------------------------------------------------------------- /test_data/Java/Repeat-a-string/repeat-a-string-2.java: -------------------------------------------------------------------------------- 1 | public static String repeat(String str, int times) { 2 | return new String(new char[times]).replace("\0", str); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Reverse-a-string/reverse-a-string-1.java: -------------------------------------------------------------------------------- 1 | public static String reverseString(String s) { 2 | return new StringBuffer(s).reverse().toString(); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Reverse-a-string/reverse-a-string-2.java: -------------------------------------------------------------------------------- 1 | public static String reverseString(String s) { 2 | return new StringBuilder(s).reverse().toString(); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Sieve-of-Eratosthenes/sieve-of-eratosthenes-2.java: -------------------------------------------------------------------------------- 1 | nums.add(2); 2 | for(int i = 3;i <= n;i += 2){ 3 | nums.add(i); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/Java/Sorting-algorithms-Bubble-sort/sorting-algorithms-bubble-sort-2.java: -------------------------------------------------------------------------------- 1 | if (comparable[a].compareTo(comparable[b]) < 0){ 2 | //same swap code as before 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/String-length/string-length-2.java: -------------------------------------------------------------------------------- 1 | String s = "Hello, world!"; 2 | int not_really_the_length = s.length(); // XXX: does not (always) count Unicode characters (code points)! 3 | -------------------------------------------------------------------------------- /test_data/Java/Tokenize-a-string/tokenize-a-string-1.java: -------------------------------------------------------------------------------- 1 | String toTokenize = "Hello,How,Are,You,Today"; 2 | System.out.println(String.join(".", toTokenize.split(","))); 3 | -------------------------------------------------------------------------------- /test_data/Java/Variadic-function/variadic-function-2.java: -------------------------------------------------------------------------------- 1 | printAll(4, 3, 5, 6, 4, 3); 2 | printAll(4, 3, 5); 3 | printAll("Rosetta", "Code", "Is", "Awesome!"); 4 | -------------------------------------------------------------------------------- /test_data/Java/Variadic-function/variadic-function-3.java: -------------------------------------------------------------------------------- 1 | Object[] args = {"Rosetta", "Code", "Is", "Awesome!"}; 2 | printAll(args); 3 | -------------------------------------------------------------------------------- /test_data/Java/Variadic-function/variadic-function-5.java: -------------------------------------------------------------------------------- 1 | printAll((Object)args); 2 | -------------------------------------------------------------------------------- /test_data/Java/Y-combinator/y-combinator-2.java: -------------------------------------------------------------------------------- 1 | public static Function Y(Function, Function> f) { 2 | return x -> f.apply(Y(f)).apply(x); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/Java/Y-combinator/y-combinator-9.java: -------------------------------------------------------------------------------- 1 | factorial[10] = 3628800 2 | ackermann[3, 2] = 29 3 | fibonacci[20] = 6765 4 | -------------------------------------------------------------------------------- /test_data/Java/Zero-to-the-zero-power/zero-to-the-zero-power.java: -------------------------------------------------------------------------------- 1 | System.out.println(Math.pow(0, 0)); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/100-doors/100-doors-12.js: -------------------------------------------------------------------------------- 1 | [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/100-doors/100-doors-5.js: -------------------------------------------------------------------------------- 1 | for(var door=1;i<10/*Math.sqrt(100)*/;i++){ 2 | console.log("Door %d is open",i*i); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/100-doors/100-doors-8.js: -------------------------------------------------------------------------------- 1 | [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/A+B/a+b-3.js: -------------------------------------------------------------------------------- 1 | process.stdin.on("data", buffer => { 2 | console.log( 3 | (buffer + "").trim().split(" ").map(Number).reduce((a, v) => a + v, 0) 4 | ); 5 | }); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/A+B/a+b-4.js: -------------------------------------------------------------------------------- 1 | var a = WScript.StdIn.ReadLine(); 2 | var b = WScript.StdIn.ReadLine(); 3 | WSH.echo(a, " + " , b , " = " , Number(a)+Number(b)); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Ackermann-function/ackermann-function.js: -------------------------------------------------------------------------------- 1 | function ack(m, n) { 2 | return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1)); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-2.js: -------------------------------------------------------------------------------- 1 | [1, 2, 3, 4, 5].map(function(v) { return v * v; }); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-3.js: -------------------------------------------------------------------------------- 1 | [1, 2, 3, 4, 5].map(v => v * v); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Arithmetic-geometric-mean/arithmetic-geometric-mean-3.js: -------------------------------------------------------------------------------- 1 | 0.8472130848351929 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Array-concatenation/array-concatenation-1.js: -------------------------------------------------------------------------------- 1 | var a = [1,2,3], 2 | b = [4,5,6], 3 | c = a.concat(b); //=> [1,2,3,4,5,6] 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Averages-Arithmetic-mean/averages-arithmetic-mean-5.js: -------------------------------------------------------------------------------- 1 | function mean(a) 2 | { 3 | return a.length ? Functional.reduce('+', 0, a) / a.length : 0; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Averages-Arithmetic-mean/averages-arithmetic-mean-7.js: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Averages-Median/averages-median-3.js: -------------------------------------------------------------------------------- 1 | [ 2 | null, 3 | 4, 4 | 3.5, 5 | 2.1 6 | ] 7 | -------------------------------------------------------------------------------- /test_data/JavaScript/Call-an-object-method/call-an-object-method.js: -------------------------------------------------------------------------------- 1 | x.y() 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Character-codes/character-codes-1.js: -------------------------------------------------------------------------------- 1 | console.log('a'.charCodeAt(0)); // prints "97" 2 | console.log(String.fromCharCode(97)); // prints "a" 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Character-codes/character-codes-2.js: -------------------------------------------------------------------------------- 1 | ['字'.codePointAt(0), '🐘'.codePointAt(0)] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Character-codes/character-codes-3.js: -------------------------------------------------------------------------------- 1 | [23383, 128024] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Character-codes/character-codes-4.js: -------------------------------------------------------------------------------- 1 | [23383, 128024].map(function (x) { 2 | return String.fromCodePoint(x); 3 | }) 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Character-codes/character-codes-5.js: -------------------------------------------------------------------------------- 1 | ["字", "🐘"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Closures-Value-capture/closures-value-capture-5.js: -------------------------------------------------------------------------------- 1 | let funcs = [...Array(10).keys()].map(i => () => i*i); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Collections/collections-1.js: -------------------------------------------------------------------------------- 1 | var array = []; 2 | array.push('abc'); 3 | array.push(123); 4 | array.push(new MyClass); 5 | console.log( array[2] ); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Combinations/combinations-5.js: -------------------------------------------------------------------------------- 1 | 0 1 2 2 | 0 1 3 3 | 0 1 4 4 | 0 2 3 5 | 0 2 4 6 | 0 3 4 7 | 1 2 3 8 | 1 2 4 9 | 1 3 4 10 | 2 3 4 11 | -------------------------------------------------------------------------------- /test_data/JavaScript/Command-line-arguments/command-line-arguments-1.js: -------------------------------------------------------------------------------- 1 | var objArgs = WScript.Arguments; 2 | for (var i = 0; i < objArgs.length; i++) 3 | WScript.Echo(objArgs.Item(i)); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Command-line-arguments/command-line-arguments-3.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < arguments.length; i++) 2 | print(arguments[i]); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Comments/comments-1.js: -------------------------------------------------------------------------------- 1 | n = n + 1; // This is a comment 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Comments/comments-2.js: -------------------------------------------------------------------------------- 1 | // This is a valid comment // with a "nested" comment 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Comments/comments-3.js: -------------------------------------------------------------------------------- 1 | /* This is 2 | a multi line 3 | comment 4 | // with a "nested" comment 5 | and another line in the comment 6 | */ 7 | -------------------------------------------------------------------------------- /test_data/JavaScript/Count-occurrences-of-a-substring/count-occurrences-of-a-substring-2.js: -------------------------------------------------------------------------------- 1 | const countSubString = (str, subStr) => str.split(subStr).length - 1; 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Day-of-the-week/day-of-the-week-4.js: -------------------------------------------------------------------------------- 1 | [2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Delete-a-file/delete-a-file-3.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.unlinkSync('myfile.txt'); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Delete-a-file/delete-a-file-4.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.unlink('myfile.txt', ()=>{ 3 | console.log("Done!"); 4 | }) 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Discordian-date/discordian-date-2.js: -------------------------------------------------------------------------------- 1 | console.log(discordianDate(new Date(Date.now()))); 2 | "Boomtime, the 2nd day of Chaos in the YOLD 3183" 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Dot-product/dot-product-4.js: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Empty-string/empty-string-1.js: -------------------------------------------------------------------------------- 1 | var s = ""; 2 | var s = new String(); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Empty-string/empty-string-2.js: -------------------------------------------------------------------------------- 1 | s == "" 2 | s.length == 0 3 | !s 4 | !Boolean(s) 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Empty-string/empty-string-3.js: -------------------------------------------------------------------------------- 1 | !!s 2 | s != "" 3 | s.length != 0 4 | s.length > 0 5 | Boolean(s) 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Enforced-immutability/enforced-immutability.js: -------------------------------------------------------------------------------- 1 | const pi = 3.1415; 2 | const msg = "Hello World"; 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Enumerations/enumerations.js: -------------------------------------------------------------------------------- 1 | // enum fruits { apple, banana, cherry } 2 | 3 | var f = "apple"; 4 | 5 | if(f == "apple"){ 6 | f = "banana"; 7 | } 8 | -------------------------------------------------------------------------------- /test_data/JavaScript/Equilibrium-index/equilibrium-index-3.js: -------------------------------------------------------------------------------- 1 | [[3,6],[],[1],[0,1,2,3,4,5,6],[0],[]] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Even-or-odd/even-or-odd-1.js: -------------------------------------------------------------------------------- 1 | function isEven( i ) { 2 | return (i & 1) === 0; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Even-or-odd/even-or-odd-2.js: -------------------------------------------------------------------------------- 1 | function isEven( i ) { 2 | return i % 2 === 0; 3 | } 4 | 5 | // Alternative 6 | function isEven( i ) { 7 | return !(i % 2); 8 | } 9 | -------------------------------------------------------------------------------- /test_data/JavaScript/Even-or-odd/even-or-odd-3.js: -------------------------------------------------------------------------------- 1 | // EMCAScript 6 2 | const isEven = x => !(x % 2) 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Exceptions/exceptions-1.js: -------------------------------------------------------------------------------- 1 | function doStuff() { 2 | throw new Error('Not implemented!'); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Execute-a-system-command/execute-a-system-command-1.js: -------------------------------------------------------------------------------- 1 | var shell = new ActiveXObject("WScript.Shell"); 2 | shell.run("cmd /c dir & pause"); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Factorial/factorial-3.js: -------------------------------------------------------------------------------- 1 | 6402373705728000 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Factorial/factorial-5.js: -------------------------------------------------------------------------------- 1 | 6402373705728000 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Factorial/factorial-6.js: -------------------------------------------------------------------------------- 1 | var factorial = n => (n < 2) ? 1 : n * factorial(n - 1); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Factors-of-an-integer/factors-of-an-integer-3.js: -------------------------------------------------------------------------------- 1 | [1, 2, 3, 6] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Fibonacci-sequence/fibonacci-sequence-1.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return n<2?n:fib(n-1)+fib(n-2); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Fibonacci-sequence/fibonacci-sequence-2.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | if (n<2) { return n; } else { return fib(n-1)+fib(n-2); } 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Fibonacci-sequence/fibonacci-sequence-3.js: -------------------------------------------------------------------------------- 1 | function fib(n) { 2 | return function(n,a,b) { 3 | return n>0 ? arguments.callee(n-1,b,a+b) : a; 4 | }(n,0,1); 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/File-modification-time/file-modification-time-2.js: -------------------------------------------------------------------------------- 1 | var file = document.getElementById("fileInput").files.item(0); 2 | var last_modified = file.lastModifiedDate; 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/File-size/file-size-1.js: -------------------------------------------------------------------------------- 1 | var fso = new ActiveXObject("Scripting.FileSystemObject"); 2 | fso.GetFile('input.txt').Size; 3 | fso.GetFile('c:/input.txt').Size; 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Filter/filter-1.js: -------------------------------------------------------------------------------- 1 | var arr = [1,2,3,4,5]; 2 | var evens = arr.filter(function(a) {return a % 2 == 0}); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Filter/filter-4.js: -------------------------------------------------------------------------------- 1 | Functional.select("+1&1", [1,2,3,4]) // [2, 4] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Filter/filter-6.js: -------------------------------------------------------------------------------- 1 | [2, 4, 6, 8] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Find-the-missing-permutation/find-the-missing-permutation-3.js: -------------------------------------------------------------------------------- 1 | ["DBAC"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Flatten-a-list/flatten-a-list-5.js: -------------------------------------------------------------------------------- 1 | let flatten = list => list.reduce( 2 | (a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), [] 3 | ); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Formatted-numeric-output/formatted-numeric-output.js: -------------------------------------------------------------------------------- 1 | var n = 123; 2 | var str = ("00000" + n).slice(-5); 3 | alert(str); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-composition/function-composition-1.js: -------------------------------------------------------------------------------- 1 | function compose(f, g) { 2 | return function(x) { 3 | return f(g(x)); 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-composition/function-composition-2.js: -------------------------------------------------------------------------------- 1 | var id = compose(Math.sin, Math.asin); 2 | print(id(0.5)); // 0.5 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-1.js: -------------------------------------------------------------------------------- 1 | function multiply(a, b) { 2 | return a*b; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-2.js: -------------------------------------------------------------------------------- 1 | var multiply = function(a, b) { 2 | return a * b; 3 | }; 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-3.js: -------------------------------------------------------------------------------- 1 | var multiply = function multiply(a, b) { 2 | return a * b; 3 | }; 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-4.js: -------------------------------------------------------------------------------- 1 | var o = { 2 | multiply: function(a, b) { 3 | return a * b; 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-6.js: -------------------------------------------------------------------------------- 1 | var multiply = (a, b) => a * b; 2 | var multiply = (a, b) => { return a * b }; 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-7.js: -------------------------------------------------------------------------------- 1 | var o = { 2 | multiply(a, b) { 3 | return a * b; 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Function-definition/function-definition-8.js: -------------------------------------------------------------------------------- 1 | function * generator() { 2 | yield 1; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Generator-Exponential/generator-exponential-3.js: -------------------------------------------------------------------------------- 1 | // Generate the first 10 values 2 | for (let n = 0; n < 10; n++) { 3 | console.log(filtered.next().value) 4 | } 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Generic-swap/generic-swap-1.js: -------------------------------------------------------------------------------- 1 | function swap(arr) { 2 | var tmp = arr[0]; 3 | arr[0] = arr[1]; 4 | arr[1] = tmp; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Greatest-common-divisor/greatest-common-divisor-2.js: -------------------------------------------------------------------------------- 1 | function gcd_rec(a, b) { 2 | return b ? gcd_rec(b, a % b) : Math.abs(a); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Greatest-element-of-a-list/greatest-element-of-a-list-1.js: -------------------------------------------------------------------------------- 1 | Math.max.apply(null, [ 0, 1, 2, 5, 4 ]); // 5 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Greatest-element-of-a-list/greatest-element-of-a-list-4.js: -------------------------------------------------------------------------------- 1 | Math.max(...[ 0, 1, 2, 5, 4 ]); // 5 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Guess-the-number-With-feedback/guess-the-number-with-feedback-3.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/HTTP/http-2.js: -------------------------------------------------------------------------------- 1 | $.get('http://rosettacode.org', function(data) { 2 | console.log(data); 3 | }; 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hailstone-sequence/hailstone-sequence-5.js: -------------------------------------------------------------------------------- 1 | // Number, length of sequence 2 | {"n":77031, "l":351} 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hailstone-sequence/hailstone-sequence-8.js: -------------------------------------------------------------------------------- 1 | longestBelow(100000000) 2 | -> {"n":63728127, "l":950} 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Happy-numbers/happy-numbers-3.js: -------------------------------------------------------------------------------- 1 | [1, 7, 10, 13, 19, 23, 28, 31] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Happy-numbers/happy-numbers-5.js: -------------------------------------------------------------------------------- 1 | [1, 7, 10, 13, 19, 23, 28, 31] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Graphical/hello-world-graphical.js: -------------------------------------------------------------------------------- 1 | alert("Goodbye, World!"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Line-printer/hello-world-line-printer-2.js: -------------------------------------------------------------------------------- 1 | document.write("Hello World!"); 2 | print(); //Opens a dialog. 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Standard-error/hello-world-standard-error-1.js: -------------------------------------------------------------------------------- 1 | WScript.StdErr.WriteLine("Goodbye, World!"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Standard-error/hello-world-standard-error-2.js: -------------------------------------------------------------------------------- 1 | console.warn("Goodbye, World!") 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Standard-error/hello-world-standard-error-3.js: -------------------------------------------------------------------------------- 1 | console.error("Goodbye, World!")//only works if console object exists 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Standard-error/hello-world-standard-error-4.js: -------------------------------------------------------------------------------- 1 | throw new Error("Goodbye, World!")//Should work in any browser 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Text/hello-world-text-1.js: -------------------------------------------------------------------------------- 1 | document.write("Hello world!"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Text/hello-world-text-2.js: -------------------------------------------------------------------------------- 1 | print('Hello world!'); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Text/hello-world-text-3.js: -------------------------------------------------------------------------------- 1 | WScript.Echo("Hello world!"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Hello-world-Text/hello-world-text-4.js: -------------------------------------------------------------------------------- 1 | console.log("Hello world!") 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Infinity/infinity-1.js: -------------------------------------------------------------------------------- 1 | Infinity 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Infinity/infinity-2.js: -------------------------------------------------------------------------------- 1 | Number.POSITIVE_INFINITY 2 | Number.NEGATIVE_INFINITY 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Infinity/infinity-3.js: -------------------------------------------------------------------------------- 1 | isFinite(x) 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Inheritance-Single/inheritance-single-1.js: -------------------------------------------------------------------------------- 1 | function Animal() { 2 | // ... 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Inheritance-Single/inheritance-single-2.js: -------------------------------------------------------------------------------- 1 | function Dog() { 2 | // ... 3 | } 4 | Dog.prototype = new Animal(); 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Inheritance-Single/inheritance-single-3.js: -------------------------------------------------------------------------------- 1 | function Cat() { 2 | // ... 3 | } 4 | Cat.prototype = new Animal(); 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Inheritance-Single/inheritance-single-4.js: -------------------------------------------------------------------------------- 1 | function Collie() { 2 | // ... 3 | } 4 | Collie.prototype = new Dog(); 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Inheritance-Single/inheritance-single-5.js: -------------------------------------------------------------------------------- 1 | function Lab() { 2 | // ... 3 | } 4 | Lab.prototype = new Dog(); 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Knuth-shuffle/knuth-shuffle-3.js: -------------------------------------------------------------------------------- 1 | ["iota", "epsilon", "kappa", "theta", "gamma", "delta", 2 | "lambda", "eta", "zeta", "beta", "mu", "alpha"] 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Knuth-shuffle/knuth-shuffle-5.js: -------------------------------------------------------------------------------- 1 | ["mu", "theta", "beta", "eta", "delta", "epsilon", 2 | "kappa", "alpha", "gamma", "lambda", "zeta", "iota"] 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Langtons-ant/langtons-ant-2.js: -------------------------------------------------------------------------------- 1 | langtonant({}, { 2 | gridsize: 100, 3 | pixlsize: 4, 4 | interval: 4 5 | }); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Leap-year/leap-year-1.js: -------------------------------------------------------------------------------- 1 | var isLeapYear = function (year) { return (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0); }; 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Leap-year/leap-year-2.js: -------------------------------------------------------------------------------- 1 | // Month values start at 0, so 1 is for February 2 | var isLeapYear = function (year) { return new Date(year, 1, 29).getDate() === 29; }; 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Levenshtein-distance/levenshtein-distance-3.js: -------------------------------------------------------------------------------- 1 | [3, 3, 8, 8] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Literals-Integer/literals-integer.js: -------------------------------------------------------------------------------- 1 | if ( 727 == 0x2d7 && 2 | 727 == 01327 ) 3 | window.alert("true"); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loop-over-multiple-arrays-simultaneously/loop-over-multiple-arrays-simultaneously-6.js: -------------------------------------------------------------------------------- 1 | aA1 2 | bB2 3 | cC3 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Continue/loops-continue-3.js: -------------------------------------------------------------------------------- 1 | 1, 2, 3, 4, 5 2 | 6, 7, 8, 9, 10 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Do-while/loops-do-while-1.js: -------------------------------------------------------------------------------- 1 | var val = 0; 2 | do { 3 | print(++val); 4 | } while (val % 6); 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Do-while/loops-do-while-3.js: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Do-while/loops-do-while-5.js: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Do-while/loops-do-while-7.js: -------------------------------------------------------------------------------- 1 | [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Downward-for/loops-downward-for-1.js: -------------------------------------------------------------------------------- 1 | for (var i=10; i>=0; --i) print(i); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Downward-for/loops-downward-for-2.js: -------------------------------------------------------------------------------- 1 | for (var i = 11; i--;) console.log(i); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Downward-for/loops-downward-for-3.js: -------------------------------------------------------------------------------- 1 | var i = 11; 2 | while (i--) console.log(i); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Downward-for/loops-downward-for-5.js: -------------------------------------------------------------------------------- 1 | console.log( 2 | range(0, 10).reverse().map( 3 | function (x) { 4 | return x; 5 | } 6 | ).join('\n') 7 | ); 8 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Downward-for/loops-downward-for-6.js: -------------------------------------------------------------------------------- 1 | console.log( 2 | range(0, 10).reverse().join('\n') 3 | ); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-For/loops-for-2.js: -------------------------------------------------------------------------------- 1 | function range(i) { 2 | return i ? range(i - 1).concat(i) : []; 3 | } 4 | 5 | range(5) --> [1, 2, 3, 4, 5] 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-For/loops-for-4.js: -------------------------------------------------------------------------------- 1 | console.log( 2 | range(5).reduce( 3 | function (a, n) { 4 | return a + Array(n + 1).join('*') + '\n'; 5 | }, '' 6 | ) 7 | ); 8 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-For/loops-for-5.js: -------------------------------------------------------------------------------- 1 | console.log( 2 | range(5).map(function(a) { 3 | return Array(a + 1).join('*'); 4 | }).join('\n') 5 | ); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Foreach/loops-foreach-1.js: -------------------------------------------------------------------------------- 1 | "alpha beta gamma delta".split(' ').forEach( 2 | function (x) { 3 | console.log(x); 4 | } 5 | ); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Foreach/loops-foreach-2.js: -------------------------------------------------------------------------------- 1 | console.log("alpha beta gamma delta".split(' ').map( 2 | function (x) { 3 | return x.toUpperCase(x); 4 | } 5 | ).join('\n')); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Foreach/loops-foreach-4.js: -------------------------------------------------------------------------------- 1 | for (var a in o) { 2 | print(o[a]); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Foreach/loops-foreach-5.js: -------------------------------------------------------------------------------- 1 | for (var a in o) { 2 | if (o.hasOwnProperty(a)) { 3 | print(o[a]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Infinite/loops-infinite-1.js: -------------------------------------------------------------------------------- 1 | for (;;) console.log("SPAM"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-Infinite/loops-infinite-2.js: -------------------------------------------------------------------------------- 1 | while (true) console.log("SPAM"); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-N-plus-one-half/loops-n-plus-one-half-3.js: -------------------------------------------------------------------------------- 1 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-N-plus-one-half/loops-n-plus-one-half-5.js: -------------------------------------------------------------------------------- 1 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-N-plus-one-half/loops-n-plus-one-half-6.js: -------------------------------------------------------------------------------- 1 | var s=1, e=10 2 | for (var i=s; i<=e; i+=1) { 3 | document.write( i==s ? '' : ', ', i ) 4 | } 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-N-plus-one-half/loops-n-plus-one-half-7.js: -------------------------------------------------------------------------------- 1 | var s=1, e=10 2 | for (;; s+=1) { 3 | document.write( s ) 4 | if (s==e) break 5 | document.write( ', ' ) 6 | } 7 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-While/loops-while-1.js: -------------------------------------------------------------------------------- 1 | var n = 1024; 2 | while (n > 0) { 3 | print(n); 4 | n /= 2; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Loops-While/loops-while-3.js: -------------------------------------------------------------------------------- 1 | 512 2 | 256 3 | 128 4 | 64 5 | 32 6 | 16 7 | 8 8 | 4 9 | 2 10 | 1 11 | -------------------------------------------------------------------------------- /test_data/JavaScript/Matrix-transposition/matrix-transposition-4.js: -------------------------------------------------------------------------------- 1 | [[1, 3, 5], [2, 4, 6]] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Monte-Carlo-methods/monte-carlo-methods-3.js: -------------------------------------------------------------------------------- 1 | [3.14, 3.1404, 3.13304, 3.142408, 3.1420304, 3.14156788] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Monty-Hall-problem/monty-hall-problem-4.js: -------------------------------------------------------------------------------- 1 | Playing 10000 games 2 | Wins when not switching door 3326 3 | Wins when switching door 6630 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Mutual-recursion/mutual-recursion-3.js: -------------------------------------------------------------------------------- 1 | var range = (m, n) => Array(... Array(n - m + 1)).map((x, i) => m + i) 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Non-decimal-radices-Input/non-decimal-radices-input-5.js: -------------------------------------------------------------------------------- 1 | parseInt("0e0", 16); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Non-decimal-radices-Input/non-decimal-radices-input-6.js: -------------------------------------------------------------------------------- 1 | parseInt("0e0"); // 0 2 | parseInt("08"); // 0, '8' is not an octal digit. 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Number-reversal-game/number-reversal-game-3.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Palindrome-detection/palindrome-detection-2.js: -------------------------------------------------------------------------------- 1 | var isPal = str => str === str.split("").reverse().join(""); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Pascals-triangle/pascals-triangle-3.js: -------------------------------------------------------------------------------- 1 | [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1],[1,5,10,10,5,1],[1,6,15,20,15,6,1]] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Perfect-numbers/perfect-numbers-3.js: -------------------------------------------------------------------------------- 1 | [6, 28, 496, 8128] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Perfect-numbers/perfect-numbers-5.js: -------------------------------------------------------------------------------- 1 | [6, 28, 496, 8128] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Perfect-numbers/perfect-numbers-7.js: -------------------------------------------------------------------------------- 1 | [6, 28, 496, 8128] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Perfect-numbers/perfect-numbers-9.js: -------------------------------------------------------------------------------- 1 | [6, 28, 496, 8128] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Permutations/permutations-3.js: -------------------------------------------------------------------------------- 1 | Aardvarks,eat,ants 2 | Aardvarks,ants,eat 3 | eat,Aardvarks,ants 4 | eat,ants,Aardvarks 5 | ants,Aardvarks,eat 6 | ants,eat,Aardvarks 7 | -------------------------------------------------------------------------------- /test_data/JavaScript/Pick-random-element/pick-random-element.js: -------------------------------------------------------------------------------- 1 | var array = [1,2,3]; 2 | return array[Math.floor(Math.random() * array.length)]; 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Program-name/program-name-1.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | return arguments.callee.name; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Program-name/program-name-2.js: -------------------------------------------------------------------------------- 1 | (function(){alert(arguments.callee.name);}()) 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Program-termination/program-termination.js: -------------------------------------------------------------------------------- 1 | if (some_condition) 2 | quit(); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Queue-Definition/queue-definition-1.js: -------------------------------------------------------------------------------- 1 | var fifo = []; 2 | fifo.push(42); // Enqueue. 3 | fifo.push(43); 4 | var x = fifo.shift(); // Dequeue. 5 | alert(x); // 42 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-1.js: -------------------------------------------------------------------------------- 1 | (function(){print("("+arguments.callee.toString().replace(/\s/g,'')+")()");})() 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-2.js: -------------------------------------------------------------------------------- 1 | var code='var q=String.fromCharCode(39);print("var code="+q+code+q+";eval(code)")';eval(code) 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-4.js: -------------------------------------------------------------------------------- 1 | var a=function () {var b="var a="+a.toString()+"\;a()";alert(b)};a() 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-5.js: -------------------------------------------------------------------------------- 1 | (function f() { 2 | 3 | return '(' + f.toString() + ')();'; 4 | 5 | })(); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-6.js: -------------------------------------------------------------------------------- 1 | (function f() { 2 | 3 | return '(' + f.toString() + ')();'; 4 | 5 | })(); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Quine/quine-7.js: -------------------------------------------------------------------------------- 1 | (function f() { 2 | 3 | console.log('(' + f.toString() + ')();'); 4 | 5 | })(); 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Range-expansion/range-expansion-3.js: -------------------------------------------------------------------------------- 1 | [-6, -3, -2, -1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Range-expansion/range-expansion-5.js: -------------------------------------------------------------------------------- 1 | [-6, -3, -2, -1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Remove-duplicate-elements/remove-duplicate-elements-4.js: -------------------------------------------------------------------------------- 1 | Array.prototype.unique = function() { 2 | return [... new Set(this)] 3 | } 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Repeat-a-string/repeat-a-string-2.js: -------------------------------------------------------------------------------- 1 | console.log("ha".repeat(5)); // hahahahaha 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Reverse-a-string/reverse-a-string-3.js: -------------------------------------------------------------------------------- 1 | ["desrever <- eb <- ot <- gnirts <- emoS", "desrever eb ot gnirts emoS"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Roman-numerals-Decode/roman-numerals-decode-3.js: -------------------------------------------------------------------------------- 1 | [1990, 1666, 2008] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Roman-numerals-Decode/roman-numerals-decode-5.js: -------------------------------------------------------------------------------- 1 | [1990, 1666, 2008] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Roman-numerals-Decode/roman-numerals-decode-7.js: -------------------------------------------------------------------------------- 1 | [1990,1666,2008,4000] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Roman-numerals-Encode/roman-numerals-encode-3.js: -------------------------------------------------------------------------------- 1 | ["MMXVI", "MCMXC", "MMVIII", "XIV.IX.MMXV", "MM", "MDCLXVI"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Roman-numerals-Encode/roman-numerals-encode-5.js: -------------------------------------------------------------------------------- 1 | ["MMXVI","MCMXC","MMVIII","MM","MDCLXVI"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Show-the-epoch/show-the-epoch.js: -------------------------------------------------------------------------------- 1 | document.write(new Date(0).toUTCString()); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sorting-algorithms-Bubble-sort/sorting-algorithms-bubble-sort-3.js: -------------------------------------------------------------------------------- 1 | var my_arr = ["G", "F", "C", "A", "B", "E", "D"]; 2 | my_arr.bubblesort(); 3 | print(my_arr); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sorting-algorithms-Quicksort/sorting-algorithms-quicksort-3.js: -------------------------------------------------------------------------------- 1 | [ 1, 3, 10, 11, 15, 19 ] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sorting-algorithms-Stooge-sort/sorting-algorithms-stooge-sort-2.js: -------------------------------------------------------------------------------- 1 | arr = [9,1,3,10,13,4,2]; 2 | stoogeSort(arr); 3 | console.log(arr); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/Stack/stack-1.js: -------------------------------------------------------------------------------- 1 | var stack = []; 2 | stack.push(1) 3 | stack.push(2,3); 4 | print(stack.pop()); // 3 5 | print(stack.length); // 2, stack empty if 0 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/String-case/string-case-1.js: -------------------------------------------------------------------------------- 1 | alert( "alphaBETA".toUpperCase() ); 2 | alert( "alphaBETA".toLowerCase() ); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/String-case/string-case-2.js: -------------------------------------------------------------------------------- 1 | var string = "alphaBETA"; 2 | var uppercase = string.toUpperCase(); 3 | var lowercase = string.toLowerCase(); 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/String-concatenation/string-concatenation.js: -------------------------------------------------------------------------------- 1 | var s = "hello" 2 | print(s + " there!") 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/String-interpolation--included-/string-interpolation--included--2.js: -------------------------------------------------------------------------------- 1 | // ECMAScript 6 2 | var X = "little"; 3 | var replaced = `Mary had a ${X} lamb`; 4 | -------------------------------------------------------------------------------- /test_data/JavaScript/String-length/string-length-1.js: -------------------------------------------------------------------------------- 1 | var s = "Hello, world!"; 2 | var byteCount = s.length * 2; //26 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sum-of-a-series/sum-of-a-series-3.js: -------------------------------------------------------------------------------- 1 | 1.6439345666815615 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sum-of-a-series/sum-of-a-series-5.js: -------------------------------------------------------------------------------- 1 | 1.6439345666815615 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sum-of-squares/sum-of-squares-3.js: -------------------------------------------------------------------------------- 1 | Functional.reduce("x+y*y", 0, [1,2,3,4,5]) 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Sum-of-squares/sum-of-squares-4.js: -------------------------------------------------------------------------------- 1 | [3,1,4,1,5,9].map(function (n) { return Math.pow(n,2); }).reduce(function (sum,n) { return sum+n; }); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Symmetric-difference/symmetric-difference-4.js: -------------------------------------------------------------------------------- 1 | ["Serena", "Jim"] 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/System-time/system-time.js: -------------------------------------------------------------------------------- 1 | console.log(new Date()) // => Sat, 28 May 2011 08:22:53 GMT 2 | console.log(Date.now()) // => 1306571005417 // Unix epoch 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Tokenize-a-string/tokenize-a-string.js: -------------------------------------------------------------------------------- 1 | alert( "Hello,How,Are,You,Today".split(",").join(".") ); 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/Towers-of-Hanoi/towers-of-hanoi-3.js: -------------------------------------------------------------------------------- 1 | ["left -> right", "left -> mid", 2 | "right -> mid", "left -> right", 3 | "mid -> left", "mid -> right", 4 | "left -> right"] 5 | -------------------------------------------------------------------------------- /test_data/JavaScript/URL-decoding/url-decoding.js: -------------------------------------------------------------------------------- 1 | decodeURIComponent("http%3A%2F%2Ffoo%20bar%2F") 2 | -------------------------------------------------------------------------------- /test_data/JavaScript/URL-encoding/url-encoding.js: -------------------------------------------------------------------------------- 1 | var normal = 'http://foo/bar/'; 2 | var encoded = encodeURIComponent(normal); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Unix-ls/unix-ls.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | fs.readdir('.', (err, names) => names.sort().map( name => console.log(name) )); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Variadic-function/variadic-function-2.js: -------------------------------------------------------------------------------- 1 | args = ["Rosetta", "Code", "Is", "Awesome!"] 2 | printAll.apply(null, args) 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Y-combinator/y-combinator-4.js: -------------------------------------------------------------------------------- 1 | function Y(f) { 2 | return function() { 3 | return f(Y(f)).apply(this, arguments); 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Y-combinator/y-combinator-5.js: -------------------------------------------------------------------------------- 1 | function Y(f) { 2 | return function() { 3 | return f(arguments.callee).apply(this, arguments); 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Y-combinator/y-combinator-8.js: -------------------------------------------------------------------------------- 1 | var Y = f => (x => x(x))(y => f(x => y(y)(x))); 2 | var fac = Y(f => n => n > 1 ? n * f(n-1) : 1); 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Zero-to-the-zero-power/zero-to-the-zero-power.js: -------------------------------------------------------------------------------- 1 | > Math.pow(0, 0); 2 | 1 3 | -------------------------------------------------------------------------------- /test_data/JavaScript/Zig-zag-matrix/zig-zag-matrix-3.js: -------------------------------------------------------------------------------- 1 | [[0, 1, 5, 6, 14], 2 | [2, 4, 7, 13, 15], 3 | [3, 8, 12, 16, 21], 4 | [9, 11, 17, 20, 22], 5 | [10, 18, 19, 23, 24]] 6 | -------------------------------------------------------------------------------- /test_data/JavaScript/Zig-zag-matrix/zig-zag-matrix-5.js: -------------------------------------------------------------------------------- 1 | [[0, 1, 5, 6, 14], 2 | [2, 4, 7, 13, 15], 3 | [3, 8, 12, 16, 21], 4 | [9, 11, 17, 20, 22], 5 | [10, 18, 19, 23, 24]] 6 | -------------------------------------------------------------------------------- /test_data/PHP/A+B/a+b-1.php: -------------------------------------------------------------------------------- 1 | fscanf(STDIN, "%d %d\n", $a, $b); //Reads 2 numbers from STDIN 2 | echo ($a + $b) . "\n"; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Array-concatenation/array-concatenation.php: -------------------------------------------------------------------------------- 1 | $arr1 = array(1, 2, 3); 2 | $arr2 = array(4, 5, 6); 3 | $arr3 = array_merge($arr1, $arr2); 4 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-1.php: -------------------------------------------------------------------------------- 1 | $NumberArray = array(0, 1, 2, 3, 4, 5, 6); 2 | $LetterArray = array("a", "b", "c", "d", "e", "f"); 3 | $simpleForm = ['apple', 'orange']; 4 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-10.php: -------------------------------------------------------------------------------- 1 | echo $CustomKeyArray["b"]; // Returns C 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-11.php: -------------------------------------------------------------------------------- 1 | $BlankArray = array(); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-12.php: -------------------------------------------------------------------------------- 1 | $BlankArray[] = "Not Blank Anymore"; 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-13.php: -------------------------------------------------------------------------------- 1 | $AssignArray["CertainKey"] = "Value"; 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-3.php: -------------------------------------------------------------------------------- 1 | $arr = ['apple', 'orange']; 2 | array_push($arr, 'pear'); 3 | print implode(',', $arr); // Returns apple,orange,pear 4 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-4.php: -------------------------------------------------------------------------------- 1 | echo $NumberArray[5]; // Returns 5 2 | echo $LetterArray[5]; // Returns f 3 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-5.php: -------------------------------------------------------------------------------- 1 | echo $MultiArray[1][5]; // 2 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-6.php: -------------------------------------------------------------------------------- 1 | print_r($MultiArray); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-8.php: -------------------------------------------------------------------------------- 1 | $StartIndexAtOne = array(1 => "A", "B", "C", "D"); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Arrays/arrays-9.php: -------------------------------------------------------------------------------- 1 | $CustomKeyArray = array("d" => "A", "c" => "B", "b" =>"C", "a" =>"D"); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Associative-array-Creation/associative-array-creation-2.php: -------------------------------------------------------------------------------- 1 | foreach($array as $key => $value) 2 | { 3 | echo "Key: $key Value: $value"; 4 | } 5 | -------------------------------------------------------------------------------- /test_data/PHP/Binary-digits/binary-digits.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Date-format/date-format.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Date-manipulation/date-manipulation.php: -------------------------------------------------------------------------------- 1 | modify('+12 hours'); 4 | echo $time->format('c'); 5 | ?> 6 | -------------------------------------------------------------------------------- /test_data/PHP/Delete-a-file/delete-a-file.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /test_data/PHP/Detect-division-by-zero/detect-division-by-zero-2.php: -------------------------------------------------------------------------------- 1 | function div_check($x, $y) { 2 | return @($x / $y) === FALSE; // works at least in PHP/5.2.6-3ubuntu4.5 3 | } 4 | -------------------------------------------------------------------------------- /test_data/PHP/Determine-if-a-string-is-numeric/determine-if-a-string-is-numeric.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Enforced-immutability/enforced-immutability-1.php: -------------------------------------------------------------------------------- 1 | define("PI", 3.14159265358); 2 | define("MSG", "Hello World"); 3 | -------------------------------------------------------------------------------- /test_data/PHP/Enforced-immutability/enforced-immutability-2.php: -------------------------------------------------------------------------------- 1 | const PI = 3.14159265358; 2 | const MSG = "Hello World"; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Environment-variables/environment-variables.php: -------------------------------------------------------------------------------- 1 | $_ENV['HOME'] 2 | -------------------------------------------------------------------------------- /test_data/PHP/Exceptions/exceptions-1.php: -------------------------------------------------------------------------------- 1 | class MyException extends Exception 2 | { 3 | // Custom exception attributes & methods 4 | } 5 | -------------------------------------------------------------------------------- /test_data/PHP/Exceptions/exceptions-2.php: -------------------------------------------------------------------------------- 1 | function throwsException() 2 | { 3 | throw new Exception('Exception message'); 4 | } 5 | -------------------------------------------------------------------------------- /test_data/PHP/Exceptions/exceptions-3.php: -------------------------------------------------------------------------------- 1 | try { 2 | throwsException(); 3 | } catch (Exception $e) { 4 | echo 'Caught exception: ' . $e->getMessage(); 5 | } 6 | -------------------------------------------------------------------------------- /test_data/PHP/Execute-a-system-command/execute-a-system-command-1.php: -------------------------------------------------------------------------------- 1 | @exec($command,$output); 2 | echo nl2br($output); 3 | -------------------------------------------------------------------------------- /test_data/PHP/Factorial/factorial-3.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test_data/PHP/Factorial/factorial-4.php: -------------------------------------------------------------------------------- 1 | gmp_fact($n) 2 | -------------------------------------------------------------------------------- /test_data/PHP/Fibonacci-sequence/fibonacci-sequence-2.php: -------------------------------------------------------------------------------- 1 | function fibRec($n) { 2 | return $n < 2 ? $n : fibRec($n-1) + fibRec($n-2); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/PHP/File-size/file-size.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Filter/filter-1.php: -------------------------------------------------------------------------------- 1 | $arr = range(1,5); 2 | $evens = array(); 3 | foreach ($arr as $val){ 4 | if ($val % 2 == 0) $evens[] = $val); 5 | } 6 | print_r($evens); 7 | -------------------------------------------------------------------------------- /test_data/PHP/Filter/filter-2.php: -------------------------------------------------------------------------------- 1 | function is_even($var) { return(!($var & 1)); } 2 | $arr = range(1,5); 3 | $evens = array_filter($arr, "is_even"); 4 | print_r($evens); 5 | -------------------------------------------------------------------------------- /test_data/PHP/Find-limit-of-recursion/find-limit-of-recursion.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Generic-swap/generic-swap.php: -------------------------------------------------------------------------------- 1 | function swap(&$a, &$b) { 2 | list($a, $b) = array($b, $a); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/PHP/Greatest-element-of-a-list/greatest-element-of-a-list.php: -------------------------------------------------------------------------------- 1 | max($values) 2 | -------------------------------------------------------------------------------- /test_data/PHP/Greatest-subsequential-sum/greatest-subsequential-sum-2.php: -------------------------------------------------------------------------------- 1 | 0 15 3 -9 12 2 | (empty) 3 | 4 4 | -------------------------------------------------------------------------------- /test_data/PHP/HTTP/http.php: -------------------------------------------------------------------------------- 1 | readfile("http://www.rosettacode.org"); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Hash-from-two-arrays/hash-from-two-arrays-1.php: -------------------------------------------------------------------------------- 1 | $keys = array('a', 'b', 'c'); 2 | $values = array(1, 2, 3); 3 | $hash = array_combine($keys, $values); 4 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Line-printer/hello-world-line-printer-1.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Line-printer/hello-world-line-printer-2.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Standard-error/hello-world-standard-error-1.php: -------------------------------------------------------------------------------- 1 | fprintf(STDERR, "Goodbye, World!\n"); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Standard-error/hello-world-standard-error-2.php: -------------------------------------------------------------------------------- 1 | file_put_contents("php://stderr","Hello World!\n"); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Text/hello-world-text-1.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test_data/PHP/Hello-world-Text/hello-world-text-2.php: -------------------------------------------------------------------------------- 1 | Hello world! 2 | -------------------------------------------------------------------------------- /test_data/PHP/Higher-order-functions/higher-order-functions-2.php: -------------------------------------------------------------------------------- 1 | function first($func) { 2 | return $func(); 3 | } 4 | 5 | $result = first(function() { return 'second'; }); 6 | -------------------------------------------------------------------------------- /test_data/PHP/Increment-a-numerical-string/increment-a-numerical-string.php: -------------------------------------------------------------------------------- 1 | $s = "12345"; 2 | $s++; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Infinity/infinity.php: -------------------------------------------------------------------------------- 1 | INF 2 | -------------------------------------------------------------------------------- /test_data/PHP/Input-loop/input-loop-2.php: -------------------------------------------------------------------------------- 1 | $lines = file($filename); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Input-loop/input-loop-3.php: -------------------------------------------------------------------------------- 1 | $contents = file_get_contents($filename); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Leap-year/leap-year-2.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test_data/PHP/Levenshtein-distance/levenshtein-distance.php: -------------------------------------------------------------------------------- 1 | echo levenshtein('kitten','sitting'); 2 | echo levenshtein('rosettacode', 'raisethysword'); 3 | -------------------------------------------------------------------------------- /test_data/PHP/Literals-Integer/literals-integer.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-Do-while/loops-do-while.php: -------------------------------------------------------------------------------- 1 | $val = 0; 2 | do { 3 | $val++; 4 | print "$val\n"; 5 | } while ($val % 6 != 0); 6 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-Downward-for/loops-downward-for-1.php: -------------------------------------------------------------------------------- 1 | for ($i = 10; $i >= 0; $i--) 2 | echo "$i\n"; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-Downward-for/loops-downward-for-2.php: -------------------------------------------------------------------------------- 1 | foreach (range(10, 0) as $i) 2 | echo "$i\n"; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-For-with-a-specified-step/loops-for-with-a-specified-step.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-For/loops-for-1.php: -------------------------------------------------------------------------------- 1 | for ($i = 1; $i <= 5; $i++) { 2 | for ($j = 1; $j <= $i; $j++) { 3 | echo '*'; 4 | } 5 | echo "\n"; 6 | } 7 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-For/loops-for-2.php: -------------------------------------------------------------------------------- 1 | foreach (range(1, 5) as $i) { 2 | foreach (range(1, $i) as $j) { 3 | echo '*'; 4 | } 5 | echo "\n"; 6 | } 7 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-Foreach/loops-foreach.php: -------------------------------------------------------------------------------- 1 | foreach ($collect as $i) { 2 | echo "$i\n"; 3 | } 4 | 5 | foreach ($collect as $key => $i) { 6 | echo "\$collect[$key] = $i\n"; 7 | } 8 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-Infinite/loops-infinite.php: -------------------------------------------------------------------------------- 1 | while(1) 2 | echo "SPAM\n"; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Loops-While/loops-while.php: -------------------------------------------------------------------------------- 1 | $i = 1024; 2 | while ($i > 0) { 3 | echo "$i\n"; 4 | $i >>= 1; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/PHP/Non-decimal-radices-Convert/non-decimal-radices-convert-1.php: -------------------------------------------------------------------------------- 1 | base_convert("26", 10, 16); // returns "1a" 2 | -------------------------------------------------------------------------------- /test_data/PHP/Non-decimal-radices-Convert/non-decimal-radices-convert-2.php: -------------------------------------------------------------------------------- 1 | intval("1a", 16); // returns 26 2 | -------------------------------------------------------------------------------- /test_data/PHP/Non-decimal-radices-Convert/non-decimal-radices-convert-3.php: -------------------------------------------------------------------------------- 1 | base_convert(26, 10, 16); // returns "1a" 2 | -------------------------------------------------------------------------------- /test_data/PHP/Non-decimal-radices-Output/non-decimal-radices-output-2.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Null-object/null-object.php: -------------------------------------------------------------------------------- 1 | $x = NULL; 2 | if (is_null($x)) 3 | echo "\$x is null\n"; 4 | -------------------------------------------------------------------------------- /test_data/PHP/Palindrome-detection/palindrome-detection-1.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Pick-random-element/pick-random-element.php: -------------------------------------------------------------------------------- 1 | $arr = array('foo', 'bar', 'baz'); 2 | $x = $arr[array_rand($arr)]; 3 | -------------------------------------------------------------------------------- /test_data/PHP/Primality-by-trial-division/primality-by-trial-division-2.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test_data/PHP/Program-name/program-name.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Program-termination/program-termination.php: -------------------------------------------------------------------------------- 1 | if (problem) 2 | exit(1); 3 | -------------------------------------------------------------------------------- /test_data/PHP/Quine/quine.php: -------------------------------------------------------------------------------- 1 | 2 | '; printf($p,39,$p,39); ?> 3 | -------------------------------------------------------------------------------- /test_data/PHP/Read-entire-file/read-entire-file.php: -------------------------------------------------------------------------------- 1 | file_get_contents($filename) 2 | -------------------------------------------------------------------------------- /test_data/PHP/Remove-duplicate-elements/remove-duplicate-elements.php: -------------------------------------------------------------------------------- 1 | $list = array(1, 2, 3, 'a', 'b', 'c', 2, 3, 4, 'b', 'c', 'd'); 2 | $unique_list = array_unique($list); 3 | -------------------------------------------------------------------------------- /test_data/PHP/Repeat-a-string/repeat-a-string.php: -------------------------------------------------------------------------------- 1 | str_repeat("ha", 5) 2 | -------------------------------------------------------------------------------- /test_data/PHP/Return-multiple-values/return-multiple-values-1.php: -------------------------------------------------------------------------------- 1 | function addsub($x, $y) { 2 | return array($x + $y, $x - $y); 3 | } 4 | -------------------------------------------------------------------------------- /test_data/PHP/Return-multiple-values/return-multiple-values-2.php: -------------------------------------------------------------------------------- 1 | list($sum, $difference) = addsub(33, 12); 2 | echo "33 + 12 = $sum\n"; 3 | echo "33 - 12 = $difference\n"; 4 | -------------------------------------------------------------------------------- /test_data/PHP/Reverse-a-string/reverse-a-string-1.php: -------------------------------------------------------------------------------- 1 | strrev($string); 2 | -------------------------------------------------------------------------------- /test_data/PHP/Rot-13/rot-13-1.php: -------------------------------------------------------------------------------- 1 | echo str_rot13('foo'), "\n"; 2 | -------------------------------------------------------------------------------- /test_data/PHP/Show-the-epoch/show-the-epoch.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test_data/PHP/Sleep/sleep-1.php: -------------------------------------------------------------------------------- 1 | $seconds = 42; 2 | echo "Sleeping...\n"; 3 | sleep($seconds); # number is integer in seconds 4 | echo "Awake!\n"; 5 | -------------------------------------------------------------------------------- /test_data/PHP/Sleep/sleep-2.php: -------------------------------------------------------------------------------- 1 | $microseconds = 42000000; 2 | echo "Sleeping...\n"; 3 | usleep($microseconds); # number is integer in microseconds 4 | echo "Awake!\n"; 5 | -------------------------------------------------------------------------------- /test_data/PHP/Sort-an-integer-array/sort-an-integer-array.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/String-concatenation/string-concatenation.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /test_data/PHP/Sum-and-product-of-an-array/sum-and-product-of-an-array.php: -------------------------------------------------------------------------------- 1 | $array = array(1,2,3,4,5,6,7,8,9); 2 | echo array_sum($array); 3 | echo array_product($array); 4 | -------------------------------------------------------------------------------- /test_data/PHP/Sum-of-squares/sum-of-squares-2.php: -------------------------------------------------------------------------------- 1 | function sum_squares(array $args) { 2 | return array_reduce($args, function($x, $y) { 3 | return $x+$y*$y; 4 | }, 0); 5 | } 6 | -------------------------------------------------------------------------------- /test_data/PHP/System-time/system-time-1.php: -------------------------------------------------------------------------------- 1 | echo time(), "\n"; 2 | -------------------------------------------------------------------------------- /test_data/PHP/System-time/system-time-2.php: -------------------------------------------------------------------------------- 1 | echo microtime(), "\n"; 2 | -------------------------------------------------------------------------------- /test_data/PHP/Tokenize-a-string/tokenize-a-string.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/URL-encoding/url-encoding.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Unix-ls/unix-ls.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Variadic-function/variadic-function-4.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/PHP/Walk-a-directory-Non-recursively/walk-a-directory-non-recursively-3.php: -------------------------------------------------------------------------------- 1 | foreach (glob('/home/foo/bar/*.php') as $file){ 2 | echo "$file\n"; 3 | } 4 | -------------------------------------------------------------------------------- /test_data/PHP/Y-combinator/y-combinator-2.php: -------------------------------------------------------------------------------- 1 | function Y($f) { 2 | return function() use($f) { 3 | return call_user_func_array($f(Y($f)), func_get_args()); 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /test_data/PHP/Zero-to-the-zero-power/zero-to-the-zero-power.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test_data/Python/100-doors/100-doors-2.py: -------------------------------------------------------------------------------- 1 | for i in xrange(1, 101): 2 | root = i ** 0.5 3 | print "Door %d:" % i, 'open' if root == int(root) else 'close' 4 | -------------------------------------------------------------------------------- /test_data/Python/100-doors/100-doors-3.py: -------------------------------------------------------------------------------- 1 | print '\n'.join(['Door %s is %s' % (i, ('closed', 'open')[(i**0.5).is_integer()]) for i in xrange(1, 101)]) 2 | -------------------------------------------------------------------------------- /test_data/Python/100-doors/100-doors-4.py: -------------------------------------------------------------------------------- 1 | print '\n'.join('Door %s is %s' % (i, 'closed' if i**0.5 % 1 else 'open') for i in range(1, 101)) 2 | -------------------------------------------------------------------------------- /test_data/Python/100-doors/100-doors-6.py: -------------------------------------------------------------------------------- 1 | for i in range(1,11): print("Door %s is open" % i**2) 2 | -------------------------------------------------------------------------------- /test_data/Python/A+B/a+b-1.py: -------------------------------------------------------------------------------- 1 | try: raw_input 2 | except: raw_input = input 3 | 4 | print(sum(map(int, raw_input().split()))) 5 | -------------------------------------------------------------------------------- /test_data/Python/A+B/a+b-2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | for line in sys.stdin: 4 | print(sum(map(int, line.split()))) 5 | -------------------------------------------------------------------------------- /test_data/Python/Ackermann-function/ackermann-function-1.py: -------------------------------------------------------------------------------- 1 | def ack1(M, N): 2 | return (N + 1) if M == 0 else ( 3 | ack1(M-1, 1) if N == 0 else ack1(M-1, ack1(M, N-1))) 4 | -------------------------------------------------------------------------------- /test_data/Python/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-2.py: -------------------------------------------------------------------------------- 1 | print " ".join(str(n * n) for n in range(10)) 2 | -------------------------------------------------------------------------------- /test_data/Python/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-3.py: -------------------------------------------------------------------------------- 1 | print " ".join(map(str, map(square, range(10)))) 2 | -------------------------------------------------------------------------------- /test_data/Python/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-4.py: -------------------------------------------------------------------------------- 1 | 0 1 4 9 16 25 36 49 64 81 2 | -------------------------------------------------------------------------------- /test_data/Python/Array-concatenation/array-concatenation-2.py: -------------------------------------------------------------------------------- 1 | arr5 = [4, 5, 6] 2 | arr6 = [7, 8, 9] 3 | arr6 += arr5 4 | assert arr6 == [7, 8, 9, 4, 5, 6] 5 | -------------------------------------------------------------------------------- /test_data/Python/Arrays/arrays-1.py: -------------------------------------------------------------------------------- 1 | array = [] 2 | 3 | array.append(1) 4 | array.append(3) 5 | 6 | array[0] = 2 7 | 8 | print array[0] 9 | -------------------------------------------------------------------------------- /test_data/Python/Arrays/arrays-2.py: -------------------------------------------------------------------------------- 1 | myArray = [0] * size 2 | -------------------------------------------------------------------------------- /test_data/Python/Arrays/arrays-3.py: -------------------------------------------------------------------------------- 1 | myArray = [[0]* width] * height] # DOES NOT WORK AS INTENDED!!! 2 | -------------------------------------------------------------------------------- /test_data/Python/Arrays/arrays-4.py: -------------------------------------------------------------------------------- 1 | myArray = [[0 for x in range(width)] for y in range(height)] 2 | -------------------------------------------------------------------------------- /test_data/Python/Arrays/arrays-5.py: -------------------------------------------------------------------------------- 1 | myArray = list() 2 | for x in range(height): 3 | myArray.append([0] * width) 4 | -------------------------------------------------------------------------------- /test_data/Python/Associative-array-Creation/associative-array-creation-3.py: -------------------------------------------------------------------------------- 1 | myDict = { '1': 'a string', 1: 'an integer', 1.0: 'a floating point number', (1,): 'a tuple' } 2 | -------------------------------------------------------------------------------- /test_data/Python/Averages-Arithmetic-mean/averages-arithmetic-mean-2.py: -------------------------------------------------------------------------------- 1 | 2.3 2 | 2.3 3 | -------------------------------------------------------------------------------- /test_data/Python/Averages-Arithmetic-mean/averages-arithmetic-mean-4.py: -------------------------------------------------------------------------------- 1 | 2.3 2 | 1e-21 3 | -------------------------------------------------------------------------------- /test_data/Python/Averages-Arithmetic-mean/averages-arithmetic-mean-6.py: -------------------------------------------------------------------------------- 1 | 2.3 2 | -------------------------------------------------------------------------------- /test_data/Python/Averages-Mode/averages-mode-3.py: -------------------------------------------------------------------------------- 1 | def onemode(values): 2 | return max(set(values), key=values.count) 3 | -------------------------------------------------------------------------------- /test_data/Python/Character-codes/character-codes-1.py: -------------------------------------------------------------------------------- 1 | print ord('a') # prints "97" 2 | print chr(97) # prints "a" 3 | -------------------------------------------------------------------------------- /test_data/Python/Character-codes/character-codes-2.py: -------------------------------------------------------------------------------- 1 | print ord(u'π') # prints "960" 2 | print unichr(960) # prints "π" 3 | -------------------------------------------------------------------------------- /test_data/Python/Classes/classes-2.py: -------------------------------------------------------------------------------- 1 | class MyClass(object): 2 | ... 3 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-1.py: -------------------------------------------------------------------------------- 1 | funcs = [] 2 | for i in range(10): 3 | funcs.append(lambda: i * i) 4 | print funcs[3]() # prints 81 5 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-2.py: -------------------------------------------------------------------------------- 1 | funcs = [] 2 | for i in range(10): 3 | funcs.append(lambda i=i: i * i) 4 | print funcs[3]() # prints 9 5 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-3.py: -------------------------------------------------------------------------------- 1 | funcs = [lambda i=i: i * i for i in range(10)] 2 | print funcs[3]() # prints 9 3 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-4.py: -------------------------------------------------------------------------------- 1 | funcs = [] 2 | for i in range(10): 3 | funcs.append((lambda i: lambda: i * i)(i)) 4 | print funcs[3]() # prints 9 5 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-5.py: -------------------------------------------------------------------------------- 1 | funcs = [(lambda i: lambda: i)(i * i) for i in range(10)] 2 | print funcs[3]() # prints 9 3 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-6.py: -------------------------------------------------------------------------------- 1 | funcs = map(lambda i: lambda: i * i, range(10)) 2 | print funcs[3]() # prints 9 3 | -------------------------------------------------------------------------------- /test_data/Python/Closures-Value-capture/closures-value-capture-7.py: -------------------------------------------------------------------------------- 1 | funcs=[eval("lambda:%s"%i**2)for i in range(10)] 2 | print funcs[3]() # prints 9 3 | -------------------------------------------------------------------------------- /test_data/Python/Combinations/combinations-3.py: -------------------------------------------------------------------------------- 1 | >>> comb(3, range(5)) 2 | [[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]] 3 | -------------------------------------------------------------------------------- /test_data/Python/Command-line-arguments/command-line-arguments.py: -------------------------------------------------------------------------------- 1 | import sys 2 | program_name = sys.argv[0] 3 | arguments = sys.argv[1:] 4 | count = len(arguments) 5 | -------------------------------------------------------------------------------- /test_data/Python/Comments/comments-1.py: -------------------------------------------------------------------------------- 1 | # This is a comment 2 | foo = 5 # You can also append comments to statements 3 | -------------------------------------------------------------------------------- /test_data/Python/Compound-data-type/compound-data-type-1.py: -------------------------------------------------------------------------------- 1 | X, Y = 0, 1 2 | p = (3, 4) 3 | p = [3, 4] 4 | 5 | print p[X] 6 | -------------------------------------------------------------------------------- /test_data/Python/Compound-data-type/compound-data-type-4.py: -------------------------------------------------------------------------------- 1 | pseudo_object = {'x': 1, 'y': 2} 2 | -------------------------------------------------------------------------------- /test_data/Python/Count-in-octal/count-in-octal.py: -------------------------------------------------------------------------------- 1 | import sys 2 | for n in xrange(sys.maxint): 3 | print oct(n) 4 | -------------------------------------------------------------------------------- /test_data/Python/Count-occurrences-of-a-substring/count-occurrences-of-a-substring.py: -------------------------------------------------------------------------------- 1 | >>> "the three truths".count("th") 2 | 3 3 | >>> "ababababab".count("abab") 4 | 2 5 | -------------------------------------------------------------------------------- /test_data/Python/Day-of-the-week/day-of-the-week.py: -------------------------------------------------------------------------------- 1 | from calendar import weekday, SUNDAY 2 | 3 | [year for year in range(2008, 2122) if weekday(year, 12, 25) == SUNDAY] 4 | -------------------------------------------------------------------------------- /test_data/Python/Delete-a-file/delete-a-file-2.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | shutil.rmtree("docs") 3 | -------------------------------------------------------------------------------- /test_data/Python/Determine-if-a-string-is-numeric/determine-if-a-string-is-numeric-2.py: -------------------------------------------------------------------------------- 1 | '123'.isdigit() 2 | -------------------------------------------------------------------------------- /test_data/Python/Empty-string/empty-string.py: -------------------------------------------------------------------------------- 1 | s = '' 2 | if not s: 3 | print('String s is empty.') 4 | if s: 5 | print('String s is not empty.') 6 | -------------------------------------------------------------------------------- /test_data/Python/Enumerations/enumerations-2.py: -------------------------------------------------------------------------------- 1 | FIRST_NAME, LAST_NAME, PHONE = range(3) 2 | -------------------------------------------------------------------------------- /test_data/Python/Enumerations/enumerations-3.py: -------------------------------------------------------------------------------- 1 | vars().update((key,val) for val,key in enumerate(("FIRST_NAME","LAST_NAME","PHONE"))) 2 | -------------------------------------------------------------------------------- /test_data/Python/Environment-variables/environment-variables.py: -------------------------------------------------------------------------------- 1 | import os 2 | os.environ['HOME'] 3 | -------------------------------------------------------------------------------- /test_data/Python/Even-or-odd/even-or-odd-2.py: -------------------------------------------------------------------------------- 1 | >> def is_even(i): 2 | return (i % 2) == 0 3 | 4 | >>> is_even(1) 5 | False 6 | >>> is_even(2) 7 | True 8 | >>> 9 | -------------------------------------------------------------------------------- /test_data/Python/Exceptions/exceptions-1.py: -------------------------------------------------------------------------------- 1 | import exceptions 2 | class SillyError(exceptions.Exception): 3 | def __init__(self,args=None): 4 | self.args=args 5 | -------------------------------------------------------------------------------- /test_data/Python/Exceptions/exceptions-2.py: -------------------------------------------------------------------------------- 1 | class MyInvalidArgument(ValueError): 2 | pass 3 | -------------------------------------------------------------------------------- /test_data/Python/Exceptions/exceptions-3.py: -------------------------------------------------------------------------------- 1 | def spam(): 2 | raise SillyError # equivalent to raise SillyError() 3 | -------------------------------------------------------------------------------- /test_data/Python/Exceptions/exceptions-4.py: -------------------------------------------------------------------------------- 1 | def spam(): 2 | raise SillyError, 'egg' # equivalent to raise SillyError('egg') 3 | -------------------------------------------------------------------------------- /test_data/Python/Exceptions/exceptions-5.py: -------------------------------------------------------------------------------- 1 | def spam(): 2 | raise SillyError('egg') 3 | -------------------------------------------------------------------------------- /test_data/Python/Execute-a-system-command/execute-a-system-command-4.py: -------------------------------------------------------------------------------- 1 | import commands 2 | stat, out = commands.getstatusoutput('ls') 3 | if not stat: 4 | print out 5 | -------------------------------------------------------------------------------- /test_data/Python/Factorial/factorial-1.py: -------------------------------------------------------------------------------- 1 | import math 2 | math.factorial(n) 3 | -------------------------------------------------------------------------------- /test_data/Python/Factorial/factorial-2.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | result = 1 3 | for i in range(1, n+1): 4 | result *= i 5 | return result 6 | -------------------------------------------------------------------------------- /test_data/Python/Factorial/factorial-3.py: -------------------------------------------------------------------------------- 1 | from operator import mul 2 | from functools import reduce 3 | 4 | def factorial(n): 5 | return reduce(mul, range(1,n+1), 1) 6 | -------------------------------------------------------------------------------- /test_data/Python/Factorial/factorial-4.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | z=1 3 | if n>1: 4 | z=n*factorial(n-1) 5 | return z 6 | -------------------------------------------------------------------------------- /test_data/Python/Factors-of-an-integer/factors-of-an-integer-1.py: -------------------------------------------------------------------------------- 1 | >>> def factors(n): 2 | return [i for i in range(1, n + 1) if not n%i] 3 | -------------------------------------------------------------------------------- /test_data/Python/Fibonacci-sequence/fibonacci-sequence-4.py: -------------------------------------------------------------------------------- 1 | def fibRec(n): 2 | if n < 2: 3 | return n 4 | else: 5 | return fibRec(n-1) + fibRec(n-2) 6 | -------------------------------------------------------------------------------- /test_data/Python/Fibonacci-sequence/fibonacci-sequence-7.py: -------------------------------------------------------------------------------- 1 | def fibGen(n): 2 | a, b = 0, 1 3 | while n>0: 4 | yield a 5 | a, b, n = b, a+b, n-1 6 | -------------------------------------------------------------------------------- /test_data/Python/Fibonacci-sequence/fibonacci-sequence-8.py: -------------------------------------------------------------------------------- 1 | >>> [i for i in fibGen(11)] 2 | 3 | [0,1,1,2,3,5,8,13,21,34,55] 4 | -------------------------------------------------------------------------------- /test_data/Python/File-input-output/file-input-output-1.py: -------------------------------------------------------------------------------- 1 | import shutil 2 | shutil.copyfile('input.txt', 'output.txt') 3 | -------------------------------------------------------------------------------- /test_data/Python/File-size/file-size.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | size = os.path.getsize('input.txt') 4 | size = os.path.getsize('/input.txt') 5 | -------------------------------------------------------------------------------- /test_data/Python/Filter/filter-2.py: -------------------------------------------------------------------------------- 1 | values = range(10) 2 | evens = values[::2] 3 | -------------------------------------------------------------------------------- /test_data/Python/Filter/filter-3.py: -------------------------------------------------------------------------------- 1 | values = range(10) 2 | values[::2] = [11,13,15,17,19] 3 | print values 4 | 11, 1, 13, 3, 15, 5, 17, 7, 19, 9 5 | -------------------------------------------------------------------------------- /test_data/Python/Find-limit-of-recursion/find-limit-of-recursion-1.py: -------------------------------------------------------------------------------- 1 | import sys 2 | print(sys.getrecursionlimit()) 3 | -------------------------------------------------------------------------------- /test_data/Python/Find-limit-of-recursion/find-limit-of-recursion-2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.setrecursionlimit(12345) 3 | -------------------------------------------------------------------------------- /test_data/Python/Find-limit-of-recursion/find-limit-of-recursion-3.py: -------------------------------------------------------------------------------- 1 | def recurse(counter): 2 | print(counter) 3 | counter += 1 4 | recurse(counter) 5 | -------------------------------------------------------------------------------- /test_data/Python/Floyds-triangle/floyds-triangle-2.py: -------------------------------------------------------------------------------- 1 | def floyd(rowcount=5): 2 | return [list(range(i*(i-1)//2+1, i*(i+1)//2+1)) 3 | for i in range(1, rowcount+1)] 4 | -------------------------------------------------------------------------------- /test_data/Python/Function-composition/function-composition-1.py: -------------------------------------------------------------------------------- 1 | compose = lambda f, g: lambda x: f( g(x) ) 2 | -------------------------------------------------------------------------------- /test_data/Python/Function-definition/function-definition-1.py: -------------------------------------------------------------------------------- 1 | def multiply(a, b): 2 | return a * b 3 | -------------------------------------------------------------------------------- /test_data/Python/Function-definition/function-definition-2.py: -------------------------------------------------------------------------------- 1 | multiply = lambda a, b: a * b 2 | -------------------------------------------------------------------------------- /test_data/Python/Generic-swap/generic-swap-1.py: -------------------------------------------------------------------------------- 1 | a, b = b, a 2 | -------------------------------------------------------------------------------- /test_data/Python/Generic-swap/generic-swap-2.py: -------------------------------------------------------------------------------- 1 | def swap(a, b): 2 | return b, a 3 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-common-divisor/greatest-common-divisor-1.py: -------------------------------------------------------------------------------- 1 | from fractions import gcd 2 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-common-divisor/greatest-common-divisor-2.py: -------------------------------------------------------------------------------- 1 | def gcd_iter(u, v): 2 | while v: 3 | u, v = v, u % v 4 | return abs(u) 5 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-common-divisor/greatest-common-divisor-3.py: -------------------------------------------------------------------------------- 1 | def gcd(u, v): 2 | return gcd(v, u % v) if v else abs(u) 3 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-element-of-a-list/greatest-element-of-a-list-1.py: -------------------------------------------------------------------------------- 1 | max(values) 2 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-element-of-a-list/greatest-element-of-a-list-3.py: -------------------------------------------------------------------------------- 1 | >>> max(float(x) for x in floatstrings) 2 | 100.0 3 | >>> 4 | -------------------------------------------------------------------------------- /test_data/Python/Greatest-element-of-a-list/greatest-element-of-a-list-4.py: -------------------------------------------------------------------------------- 1 | >>> mylist = [47, 11, 42, 102, 13] 2 | >>> reduce(lambda a,b: a if (a > b) else b, mylist) 3 | 102 4 | -------------------------------------------------------------------------------- /test_data/Python/HTTP/http-1.py: -------------------------------------------------------------------------------- 1 | import urllib.request 2 | print(urllib.request.urlopen("http://rosettacode.org").read()) 3 | -------------------------------------------------------------------------------- /test_data/Python/HTTP/http-3.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | print urllib.urlopen("http://rosettacode.org").read() 3 | -------------------------------------------------------------------------------- /test_data/Python/HTTP/http-4.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | print urllib2.urlopen("http://rosettacode.org").read() 3 | -------------------------------------------------------------------------------- /test_data/Python/Hash-from-two-arrays/hash-from-two-arrays-1.py: -------------------------------------------------------------------------------- 1 | keys = ['a', 'b', 'c'] 2 | values = [1, 2, 3] 3 | hash = {key: value for key, value in zip(keys, values)} 4 | -------------------------------------------------------------------------------- /test_data/Python/Hash-from-two-arrays/hash-from-two-arrays-3.py: -------------------------------------------------------------------------------- 1 | keys = ['a', 'b', 'c'] 2 | values = [1, 2, 3] 3 | hash = {} 4 | for k,v in zip(keys, values): 5 | hash[k] = v 6 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Graphical/hello-world-graphical-1.py: -------------------------------------------------------------------------------- 1 | import tkMessageBox 2 | 3 | result = tkMessageBox.showinfo("Some Window Label", "Goodbye, World!") 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Graphical/hello-world-graphical-2.py: -------------------------------------------------------------------------------- 1 | from tkinter import messagebox 2 | 3 | result = messagebox.showinfo("Some Window Label", "Goodbye, World!") 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Line-printer/hello-world-line-printer-1.py: -------------------------------------------------------------------------------- 1 | lp = open("/dev/lp0") 2 | lp.write("Hello World!\n") 3 | lp.close() 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Line-printer/hello-world-line-printer-2.py: -------------------------------------------------------------------------------- 1 | lp = open("/dev/lp0","w") 2 | lp.write("Hello World!\n") 3 | lp.close() 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Standard-error/hello-world-standard-error-1.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | print >> sys.stderr, "Goodbye, World!" 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Standard-error/hello-world-standard-error-2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | print("Goodbye, World!", file=sys.stderr) 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Standard-error/hello-world-standard-error-3.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | sys.stderr.write("Goodbye, World!\n") 4 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-1.py: -------------------------------------------------------------------------------- 1 | print "Hello world!" 2 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.stdout.write("Hello world!\n") 3 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-3.py: -------------------------------------------------------------------------------- 1 | print("Hello world!") 2 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-4.py: -------------------------------------------------------------------------------- 1 | import __hello__ 2 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-5.py: -------------------------------------------------------------------------------- 1 | import __phello__ 2 | -------------------------------------------------------------------------------- /test_data/Python/Hello-world-Text/hello-world-text-6.py: -------------------------------------------------------------------------------- 1 | import __phello__.spam 2 | -------------------------------------------------------------------------------- /test_data/Python/Higher-order-functions/higher-order-functions-2.py: -------------------------------------------------------------------------------- 1 | result = first(lambda: "second") 2 | -------------------------------------------------------------------------------- /test_data/Python/Identity-matrix/identity-matrix-3.py: -------------------------------------------------------------------------------- 1 | np.mat(np.eye(size)) 2 | -------------------------------------------------------------------------------- /test_data/Python/Increment-a-numerical-string/increment-a-numerical-string.py: -------------------------------------------------------------------------------- 1 | next = str(int('123') + 1) 2 | -------------------------------------------------------------------------------- /test_data/Python/Infinity/infinity-1.py: -------------------------------------------------------------------------------- 1 | >>> float('infinity') 2 | inf 3 | -------------------------------------------------------------------------------- /test_data/Python/Infinity/infinity-2.py: -------------------------------------------------------------------------------- 1 | >>> 1.0 / 0.0 2 | Traceback (most recent call last): 3 | File "", line 1, in 4 | ZeroDivisionError: float division 5 | -------------------------------------------------------------------------------- /test_data/Python/Input-loop/input-loop-1.py: -------------------------------------------------------------------------------- 1 | while(True): 2 | x = input("What is your age? ") 3 | print(x) 4 | -------------------------------------------------------------------------------- /test_data/Python/Input-loop/input-loop-4.py: -------------------------------------------------------------------------------- 1 | line = my_file.readline() # returns a line from the file 2 | lines = my_file.readlines() # returns a list of the rest of the lines from the file 3 | -------------------------------------------------------------------------------- /test_data/Python/Input-loop/input-loop-5.py: -------------------------------------------------------------------------------- 1 | import fileinput 2 | for line in fileinput.input(): 3 | pass # process line, includes newline 4 | -------------------------------------------------------------------------------- /test_data/Python/Leap-year/leap-year-1.py: -------------------------------------------------------------------------------- 1 | import calendar 2 | calendar.isleap(year) 3 | -------------------------------------------------------------------------------- /test_data/Python/Leap-year/leap-year-2.py: -------------------------------------------------------------------------------- 1 | def is_leap_year(year): 2 | if year % 100 == 0: 3 | return year % 400 == 0 4 | return year % 4 == 0 5 | -------------------------------------------------------------------------------- /test_data/Python/Literals-Integer/literals-integer-3.py: -------------------------------------------------------------------------------- 1 | >>> # Oct(leading 0), Dec, Hex(leading 0x or 0X), in order: 2 | >>> 01327 == 727 == 0x2d7 3 | True 4 | >>> 5 | -------------------------------------------------------------------------------- /test_data/Python/Literals-String/literals-string-2.py: -------------------------------------------------------------------------------- 1 | r'\x20' == '\\x20' 2 | -------------------------------------------------------------------------------- /test_data/Python/Literals-String/literals-string-3.py: -------------------------------------------------------------------------------- 1 | ''' single triple quote ''' 2 | """ double triple quote """ 3 | -------------------------------------------------------------------------------- /test_data/Python/Long-multiplication/long-multiplication-1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | print 2**64*2**64 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Continue/loops-continue.py: -------------------------------------------------------------------------------- 1 | for i in xrange(1,11): 2 | if i % 5 == 0: 3 | print i 4 | continue 5 | print i, ",", 6 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Do-while/loops-do-while-1.py: -------------------------------------------------------------------------------- 1 | val = 0 2 | while True: 3 | val +=1 4 | print val 5 | if val % 6 == 0: break 6 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Do-while/loops-do-while-2.py: -------------------------------------------------------------------------------- 1 | val = 1 2 | print val 3 | while val % 6 != 0: 4 | val += 1 5 | print val 6 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Downward-for/loops-downward-for-1.py: -------------------------------------------------------------------------------- 1 | for i in xrange(10, -1, -1): 2 | print i 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Downward-for/loops-downward-for-2.py: -------------------------------------------------------------------------------- 1 | [i for i in xrange(10, -1, -1)] 2 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Downward-for/loops-downward-for-3.py: -------------------------------------------------------------------------------- 1 | import pprint 2 | pprint.pprint([i for i in xrange(10, -1, -1)]) 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-For-with-a-specified-step/loops-for-with-a-specified-step-1.py: -------------------------------------------------------------------------------- 1 | for i in xrange(2, 9, 2): 2 | print "%d," % i, 3 | print "who do we appreciate?" 4 | -------------------------------------------------------------------------------- /test_data/Python/Loops-For-with-a-specified-step/loops-for-with-a-specified-step-2.py: -------------------------------------------------------------------------------- 1 | for i in range(2, 9, 2): 2 | print("%d, " % i, end="") 3 | print("who do we appreciate?") 4 | -------------------------------------------------------------------------------- /test_data/Python/Loops-For/loops-for-1.py: -------------------------------------------------------------------------------- 1 | import sys 2 | for i in xrange(5): 3 | for j in xrange(i+1): 4 | sys.stdout.write("*") 5 | print 6 | -------------------------------------------------------------------------------- /test_data/Python/Loops-For/loops-for-2.py: -------------------------------------------------------------------------------- 1 | for i in range(1,6): 2 | print '*' * i 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Foreach/loops-foreach-1.py: -------------------------------------------------------------------------------- 1 | for i in collection: 2 | print i 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-Infinite/loops-infinite.py: -------------------------------------------------------------------------------- 1 | while 1: 2 | print "SPAM" 3 | -------------------------------------------------------------------------------- /test_data/Python/Loops-N-plus-one-half/loops-n-plus-one-half-1.py: -------------------------------------------------------------------------------- 1 | print ( ', '.join(str(i+1) for i in range(10)) ) 2 | -------------------------------------------------------------------------------- /test_data/Python/Loops-While/loops-while.py: -------------------------------------------------------------------------------- 1 | n = 1024 2 | while n > 0: 3 | print n 4 | n //= 2 5 | -------------------------------------------------------------------------------- /test_data/Python/N-queens-problem/n-queens-problem-2.py: -------------------------------------------------------------------------------- 1 | def board(vec): 2 | print ("\n".join('.' * i + 'Q' + '.' * (n-i-1) for i in vec) + "\n===\n") 3 | -------------------------------------------------------------------------------- /test_data/Python/Non-decimal-radices-Convert/non-decimal-radices-convert-1.py: -------------------------------------------------------------------------------- 1 | i = int('1a',16) # returns the integer 26 2 | -------------------------------------------------------------------------------- /test_data/Python/Non-decimal-radices-Output/non-decimal-radices-output-2.py: -------------------------------------------------------------------------------- 1 | for n in range(34): 2 | print " %3o %2d %2X" % (n, n, n) 3 | -------------------------------------------------------------------------------- /test_data/Python/Nth-root/nth-root-2.py: -------------------------------------------------------------------------------- 1 | print nthroot(5, 34, 10) 2 | print nthroot(10,42, 20) 3 | print nthroot(2, 5, 400) 4 | -------------------------------------------------------------------------------- /test_data/Python/Null-object/null-object.py: -------------------------------------------------------------------------------- 1 | x = None 2 | if x is None: 3 | print "x is None" 4 | else: 5 | print "x is not None" 6 | -------------------------------------------------------------------------------- /test_data/Python/Palindrome-detection/palindrome-detection-1.py: -------------------------------------------------------------------------------- 1 | def is_palindrome(s): 2 | return s == s[::-1] 3 | -------------------------------------------------------------------------------- /test_data/Python/Palindrome-detection/palindrome-detection-3.py: -------------------------------------------------------------------------------- 1 | def is_palindrome_r2(s): 2 | return not s or s[0] == s[-1] and is_palindrome_r2(s[1:-1]) 3 | -------------------------------------------------------------------------------- /test_data/Python/Perfect-numbers/perfect-numbers-2.py: -------------------------------------------------------------------------------- 1 | perf = lambda n: n == sum(i for i in xrange(1, n) if n % i == 0) 2 | -------------------------------------------------------------------------------- /test_data/Python/Permutations/permutations-1.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | for values in itertools.permutations([1,2,3]): 3 | print (values) 4 | -------------------------------------------------------------------------------- /test_data/Python/Pick-random-element/pick-random-element.py: -------------------------------------------------------------------------------- 1 | >>> import random 2 | >>> random.choice(['foo', 'bar', 'baz']) 3 | 'baz' 4 | -------------------------------------------------------------------------------- /test_data/Python/Power-set/power-set-4.py: -------------------------------------------------------------------------------- 1 | def p(l): 2 | if not l: return [[]] 3 | return p(l[1:]) + [[l[0]] + x for x in p(l[1:])] 4 | -------------------------------------------------------------------------------- /test_data/Python/Primality-by-trial-division/primality-by-trial-division-1.py: -------------------------------------------------------------------------------- 1 | def prime(a): 2 | return not (a < 2 or any(a % x == 0 for x in xrange(2, int(a**0.5) + 1))) 3 | -------------------------------------------------------------------------------- /test_data/Python/Program-termination/program-termination-1.py: -------------------------------------------------------------------------------- 1 | import sys 2 | if problem: 3 | sys.exit(1) 4 | -------------------------------------------------------------------------------- /test_data/Python/Program-termination/program-termination-2.py: -------------------------------------------------------------------------------- 1 | import os 2 | if problem: 3 | os.abort() 4 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-1.py: -------------------------------------------------------------------------------- 1 | x = 'x = %r\nprint(x %% x)' 2 | print(x % x) 3 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-10.py: -------------------------------------------------------------------------------- 1 | a = 'YSA9ICcnCmIgPSBhLmRlY29kZSgnYmFzZTY0JykKcHJpbnQgYls6NV0rYStiWzU6XQ==' 2 | b = a.decode('base64') 3 | print b[:5]+a+b[5:] 4 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-2.py: -------------------------------------------------------------------------------- 1 | x = 'x = {!r};print(x.format(x))';print(x.format(x)) 2 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-3.py: -------------------------------------------------------------------------------- 1 | import sys; sys.stdout.write(open(sys.argv[0]).read()) 2 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-4.py: -------------------------------------------------------------------------------- 1 | import sys,inspect;sys.stdout.write(inspect.getsource(inspect.currentframe())) 2 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-5.py: -------------------------------------------------------------------------------- 1 | print(__file__[:-3]) 2 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-6.py: -------------------------------------------------------------------------------- 1 | $ python print\(__file__\[\:-3\]\).py 2 | print(__file__[:-3]) 3 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-7.py: -------------------------------------------------------------------------------- 1 | $ cat print\(__file__\) 2 | print(__file__) 3 | $ python print\(__file__\) 4 | print(__file__) 5 | -------------------------------------------------------------------------------- /test_data/Python/Quine/quine-9.py: -------------------------------------------------------------------------------- 1 | x = """x = {0}{1}{0} 2 | print x.format(chr(34)*3,x)""" 3 | print x.format(chr(34)*3,x) 4 | -------------------------------------------------------------------------------- /test_data/Python/Random-numbers/random-numbers-1.py: -------------------------------------------------------------------------------- 1 | >>> import random 2 | >>> values = [random.gauss(1, .5) for i in range(1000)] 3 | >>> 4 | -------------------------------------------------------------------------------- /test_data/Python/Read-a-file-line-by-line/read-a-file-line-by-line-1.py: -------------------------------------------------------------------------------- 1 | with open("foobar.txt") as f: 2 | for line in f: 3 | process(line) 4 | -------------------------------------------------------------------------------- /test_data/Python/Read-a-file-line-by-line/read-a-file-line-by-line-2.py: -------------------------------------------------------------------------------- 1 | import fileinput 2 | for line in fileinput.input(): 3 | process(line) 4 | -------------------------------------------------------------------------------- /test_data/Python/Read-entire-file/read-entire-file-1.py: -------------------------------------------------------------------------------- 1 | open(filename).read() 2 | -------------------------------------------------------------------------------- /test_data/Python/Read-entire-file/read-entire-file-2.py: -------------------------------------------------------------------------------- 1 | open(filename, encoding='utf-8').read() 2 | -------------------------------------------------------------------------------- /test_data/Python/Read-entire-file/read-entire-file-3.py: -------------------------------------------------------------------------------- 1 | with open(filename) as f: 2 | data = f.read() 3 | -------------------------------------------------------------------------------- /test_data/Python/Remove-duplicate-elements/remove-duplicate-elements-1.py: -------------------------------------------------------------------------------- 1 | items = [1, 2, 3, 'a', 'b', 'c', 2, 3, 4, 'b', 'c', 'd'] 2 | unique = list(set(items)) 3 | -------------------------------------------------------------------------------- /test_data/Python/Repeat-a-string/repeat-a-string-1.py: -------------------------------------------------------------------------------- 1 | "ha" * 5 # ==> "hahahahaha" 2 | -------------------------------------------------------------------------------- /test_data/Python/Repeat-a-string/repeat-a-string-2.py: -------------------------------------------------------------------------------- 1 | 5 * "ha" # ==> "hahahahaha" 2 | -------------------------------------------------------------------------------- /test_data/Python/Return-multiple-values/return-multiple-values-1.py: -------------------------------------------------------------------------------- 1 | def addsub(x, y): 2 | return x + y, x - y 3 | -------------------------------------------------------------------------------- /test_data/Python/Return-multiple-values/return-multiple-values-2.py: -------------------------------------------------------------------------------- 1 | sum, difference = addsub(33, 12) 2 | print "33 + 12 = %s" % sum 3 | print "33 - 12 = %s" % difference 4 | -------------------------------------------------------------------------------- /test_data/Python/Reverse-a-string/reverse-a-string-1.py: -------------------------------------------------------------------------------- 1 | raw_input()[::-1] 2 | -------------------------------------------------------------------------------- /test_data/Python/Reverse-a-string/reverse-a-string-2.py: -------------------------------------------------------------------------------- 1 | string[::-1] 2 | -------------------------------------------------------------------------------- /test_data/Python/Reverse-a-string/reverse-a-string-3.py: -------------------------------------------------------------------------------- 1 | ''.join(reversed(string)) 2 | -------------------------------------------------------------------------------- /test_data/Python/Rot-13/rot-13-1.py: -------------------------------------------------------------------------------- 1 | >>> u'foo'.encode('rot13') 2 | 'sbb' 3 | >>> 'sbb'.decode('rot13') 4 | u'foo' 5 | -------------------------------------------------------------------------------- /test_data/Python/Show-the-epoch/show-the-epoch.py: -------------------------------------------------------------------------------- 1 | >>> import time 2 | >>> time.asctime(time.gmtime(0)) 3 | 'Thu Jan 1 00:00:00 1970' 4 | >>> 5 | -------------------------------------------------------------------------------- /test_data/Python/Sieve-of-Eratosthenes/sieve-of-eratosthenes-4.py: -------------------------------------------------------------------------------- 1 | >>> list(iprimes_upto(15)) 2 | [2, 3, 5, 7, 11, 13] 3 | -------------------------------------------------------------------------------- /test_data/Python/Sort-an-integer-array/sort-an-integer-array-1.py: -------------------------------------------------------------------------------- 1 | nums = [2,4,3,1,2] 2 | nums.sort() 3 | -------------------------------------------------------------------------------- /test_data/Python/Sort-an-integer-array/sort-an-integer-array-2.py: -------------------------------------------------------------------------------- 1 | nums = sorted([2,4,3,1,2]) 2 | -------------------------------------------------------------------------------- /test_data/Python/Sort-using-a-custom-comparator/sort-using-a-custom-comparator-2.py: -------------------------------------------------------------------------------- 1 | ['strings', 'sample', 'sorted', 'here', 'Some', 'are', 'be', 'to'] 2 | -------------------------------------------------------------------------------- /test_data/Python/Sorting-algorithms-Bogosort/sorting-algorithms-bogosort-2.py: -------------------------------------------------------------------------------- 1 | def in_order(l): 2 | return all( l[i] <= l[i+1] for i in xrange(0,len(l)-1)) 3 | -------------------------------------------------------------------------------- /test_data/Python/Stack/stack-1.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | stack = deque() 3 | stack.append(value) # pushing 4 | value = stack.pop() 5 | not stack # is empty? 6 | -------------------------------------------------------------------------------- /test_data/Python/Stack/stack-4.py: -------------------------------------------------------------------------------- 1 | while not stack.empty(): 2 | -------------------------------------------------------------------------------- /test_data/Python/Stack/stack-5.py: -------------------------------------------------------------------------------- 1 | while stack: 2 | -------------------------------------------------------------------------------- /test_data/Python/String-case/string-case-2.py: -------------------------------------------------------------------------------- 1 | print "foo's bar".title() # => "Foo'S Bar" 2 | print string.capwords("foo's bar") # => "Foo's Bar" 3 | -------------------------------------------------------------------------------- /test_data/Python/String-concatenation/string-concatenation-1.py: -------------------------------------------------------------------------------- 1 | s1 = "hello" 2 | print s1 + " world" 3 | 4 | s2 = s1 + " world" 5 | print s2 6 | -------------------------------------------------------------------------------- /test_data/Python/String-concatenation/string-concatenation-2.py: -------------------------------------------------------------------------------- 1 | s1 = "hello" 2 | print ", ".join([s1, "world", "mom"]) 3 | 4 | s2 = ", ".join([s1, "world", "mom"]) 5 | print s2 6 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-1.py: -------------------------------------------------------------------------------- 1 | print len('ascii') 2 | # 5 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-10.py: -------------------------------------------------------------------------------- 1 | print(len("𝔘𝔫𝔦𝔠𝔬𝔡𝔢")) 2 | # 7 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-11.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.maxunicode # 1114111 on a wide build, 65535 on a narrow build 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-12.py: -------------------------------------------------------------------------------- 1 | print(len('ascii')) 2 | # 5 3 | print(len('\u05d0')) # the letter Alef as unicode literal 4 | # 1 5 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-13.py: -------------------------------------------------------------------------------- 1 | print(len(b'\xd7\x90'.decode('utf-8'))) # Alef encoded as utf-8 byte sequence 2 | # 1 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-14.py: -------------------------------------------------------------------------------- 1 | print(hex(sys.maxunicode), len(unichr(0x1F4A9))) 2 | # ('0x10ffff', 1) 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-15.py: -------------------------------------------------------------------------------- 1 | print(hex(sys.maxunicode), len(unichr(0x1F4A9))) 2 | # ('0xffff', 2) 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-2.py: -------------------------------------------------------------------------------- 1 | # The letter Alef 2 | print len(u'\u05d0'.encode('utf-8')) 3 | # 2 4 | print len(u'\u05d0'.encode('iso-8859-8')) 5 | # 1 6 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-4.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.maxunicode # 1114111 on a wide build, 65535 on a narrow build 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-6.py: -------------------------------------------------------------------------------- 1 | print hex(sys.maxunicode), len(unichr(0x1F4A9)) 2 | # ('0xffff', 2) 3 | -------------------------------------------------------------------------------- /test_data/Python/String-length/string-length-7.py: -------------------------------------------------------------------------------- 1 | print(len(b'Hello, World!')) 2 | # 13 3 | -------------------------------------------------------------------------------- /test_data/Python/Sum-and-product-of-an-array/sum-and-product-of-an-array-3.py: -------------------------------------------------------------------------------- 1 | from numpy import r_ 2 | numbers = r_[1:4] 3 | total = numbers.sum() 4 | product = numbers.prod() 5 | -------------------------------------------------------------------------------- /test_data/Python/Sum-and-product-of-an-array/sum-and-product-of-an-array-4.py: -------------------------------------------------------------------------------- 1 | import math 2 | total = math.fsum(floats) 3 | -------------------------------------------------------------------------------- /test_data/Python/Sum-of-a-series/sum-of-a-series.py: -------------------------------------------------------------------------------- 1 | print ( sum(1.0 / (x * x) for x in range(1, 1001)) ) 2 | -------------------------------------------------------------------------------- /test_data/Python/Sum-of-squares/sum-of-squares-1.py: -------------------------------------------------------------------------------- 1 | sum(x*x for x in [1, 2, 3, 4, 5]) 2 | -------------------------------------------------------------------------------- /test_data/Python/Sum-of-squares/sum-of-squares-2.py: -------------------------------------------------------------------------------- 1 | sum(map(lambda x: x*x, [1, 2, 3, 4, 5])) 2 | -------------------------------------------------------------------------------- /test_data/Python/Sum-of-squares/sum-of-squares-3.py: -------------------------------------------------------------------------------- 1 | def mySumSquare(n): 2 | return reduce(lambda x,y : x + y, map(lambda x : x*x, range(n+1))) 3 | -------------------------------------------------------------------------------- /test_data/Python/System-time/system-time.py: -------------------------------------------------------------------------------- 1 | import time 2 | print time.ctime() 3 | -------------------------------------------------------------------------------- /test_data/Python/Tokenize-a-string/tokenize-a-string-1.py: -------------------------------------------------------------------------------- 1 | text = "Hello,How,Are,You,Today" 2 | tokens = text.split(',') 3 | print ('.'.join(tokens)) 4 | -------------------------------------------------------------------------------- /test_data/Python/Tokenize-a-string/tokenize-a-string-2.py: -------------------------------------------------------------------------------- 1 | print ('.'.join('Hello,How,Are,You,Today'.split(','))) 2 | -------------------------------------------------------------------------------- /test_data/Python/URL-decoding/url-decoding.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | print urllib.unquote("http%3A%2F%2Ffoo%20bar%2F") 3 | -------------------------------------------------------------------------------- /test_data/Python/URL-encoding/url-encoding.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | s = 'http://foo/bar/' 3 | s = urllib.quote(s) 4 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-1.py: -------------------------------------------------------------------------------- 1 | string = raw_input("Input a string: ") 2 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-2.py: -------------------------------------------------------------------------------- 1 | string = input("Input a string: ") 2 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-3.py: -------------------------------------------------------------------------------- 1 | number = input("Input a number: ") # Deprecated, please don't use. 2 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-4.py: -------------------------------------------------------------------------------- 1 | number = eval(input("Input a number: ")) # Evil, please don't use. 2 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-5.py: -------------------------------------------------------------------------------- 1 | number = float(raw_input("Input a number: ")) 2 | -------------------------------------------------------------------------------- /test_data/Python/User-input-Text/user-input-text-6.py: -------------------------------------------------------------------------------- 1 | number = float(input("Input a number: ")) 2 | -------------------------------------------------------------------------------- /test_data/Python/Variadic-function/variadic-function-1.py: -------------------------------------------------------------------------------- 1 | def print_all(*things): 2 | for x in things: 3 | print x 4 | -------------------------------------------------------------------------------- /test_data/Python/Variadic-function/variadic-function-2.py: -------------------------------------------------------------------------------- 1 | print_all(4, 3, 5, 6, 4, 3) 2 | print_all(4, 3, 5) 3 | print_all("Rosetta", "Code", "Is", "Awesome!") 4 | -------------------------------------------------------------------------------- /test_data/Python/Variadic-function/variadic-function-3.py: -------------------------------------------------------------------------------- 1 | args = ["Rosetta", "Code", "Is", "Awesome!"] 2 | print_all(*args) 3 | -------------------------------------------------------------------------------- /test_data/Python/Walk-a-directory-Non-recursively/walk-a-directory-non-recursively-1.py: -------------------------------------------------------------------------------- 1 | import glob 2 | for filename in glob.glob('/foo/bar/*.mp3'): 3 | print(filename) 4 | -------------------------------------------------------------------------------- /test_data/Python/Y-combinator/y-combinator-2.py: -------------------------------------------------------------------------------- 1 | Y = lambda f: lambda *args: f(Y(f))(*args) 2 | -------------------------------------------------------------------------------- /test_data/Python/Zig-zag-matrix/zig-zag-matrix-3.py: -------------------------------------------------------------------------------- 1 | [[0, 1, 5, 6, 14], 2 | [2, 4, 7, 13, 15], 3 | [3, 8, 12, 16, 21], 4 | [9, 11, 17, 20, 22], 5 | [10, 18, 19, 23, 24]] 6 | -------------------------------------------------------------------------------- /test_data/Ruby/100-doors/100-doors-3.rb: -------------------------------------------------------------------------------- 1 | n = 100 2 | (1..n).each do |i| 3 | puts "Door #{i} is #{i**0.5 == (i**0.5).round ? "open" : "closed"}" 4 | end 5 | -------------------------------------------------------------------------------- /test_data/Ruby/A+B/a+b.rb: -------------------------------------------------------------------------------- 1 | puts gets.split.map(&:to_i).inject(:+) 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Ackermann-function/ackermann-function-2.rb: -------------------------------------------------------------------------------- 1 | (0..3).each do |m| 2 | puts (0..6).map { |n| ack(m, n) }.join(' ') 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Anonymous-recursion/anonymous-recursion-2.rb: -------------------------------------------------------------------------------- 1 | (-2..12).map { |i| fib i rescue :error } 2 | => [:error, :error, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-1.rb: -------------------------------------------------------------------------------- 1 | for i in [1,2,3,4,5] do 2 | puts i**2 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-2.rb: -------------------------------------------------------------------------------- 1 | [1,2,3,4,5].each{ |i| puts i**2 } 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Apply-a-callback-to-an-array/apply-a-callback-to-an-array-3.rb: -------------------------------------------------------------------------------- 1 | [1,2,3,4,5].map{ |i| i**2 } 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Array-concatenation/array-concatenation-2.rb: -------------------------------------------------------------------------------- 1 | # concat multiple arrays: 2 | [arr1,arr2,arr3].flatten(1) 3 | # ignore nil: 4 | [arr1,arr2,arr3].compact.flatten(1) 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Associative-array-Creation/associative-array-creation-1.rb: -------------------------------------------------------------------------------- 1 | hash={} 2 | hash[666]='devil' 3 | hash[777] # => nil 4 | hash[666] # => 'devil' 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Averages-Median/averages-median-2.rb: -------------------------------------------------------------------------------- 1 | def median(aray) 2 | srtd = aray.sort 3 | alen = srtd.length 4 | (srtd[(alen-1)/2] + srtd[alen/2]) / 2.0 5 | end 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Averages-Mode/averages-mode-2.rb: -------------------------------------------------------------------------------- 1 | def one_mode(ary) 2 | ary.max_by { |x| ary.count(x) } 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Binary-digits/binary-digits-1.rb: -------------------------------------------------------------------------------- 1 | [5,50,9000].each do |n| 2 | puts "%b" % n 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Binary-digits/binary-digits-2.rb: -------------------------------------------------------------------------------- 1 | for n in [5,50,9000] 2 | puts n.to_s(2) 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Character-codes/character-codes-1.rb: -------------------------------------------------------------------------------- 1 | > ?a 2 | => 97 3 | > "a"[0] 4 | => 97 5 | > 97.chr 6 | => "a" 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Character-codes/character-codes-2.rb: -------------------------------------------------------------------------------- 1 | > "a".ord 2 | => 97 3 | > 97.chr 4 | => "a" 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Check-that-file-exists/check-that-file-exists-1.rb: -------------------------------------------------------------------------------- 1 | File.file?("input.txt") 2 | File.file?("/input.txt") 3 | File.directory?("docs") 4 | File.directory?("/docs") 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Closures-Value-capture/closures-value-capture.rb: -------------------------------------------------------------------------------- 1 | procs = Array.new(10){|i| ->{i*i} } # -> creates a lambda 2 | p procs[7].call # => 49 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Command-line-arguments/command-line-arguments.rb: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby 2 | p ARGV 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Comments/comments.rb: -------------------------------------------------------------------------------- 1 | x = "code" # I am a comment 2 | 3 | =begin hello 4 | I a POD documentation comment like Perl 5 | =end puts "code" 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Date-manipulation/date-manipulation-2.rb: -------------------------------------------------------------------------------- 1 | new = t + 12.hours 2 | new = t.in(12.hours) 3 | new = t.advance(:hours => 12) 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Day-of-the-week/day-of-the-week-1.rb: -------------------------------------------------------------------------------- 1 | require 'date' 2 | 3 | (2008..2121).each {|year| puts "25 Dec #{year}" if Date.new(year, 12, 25).sunday? } 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Day-of-the-week/day-of-the-week-2.rb: -------------------------------------------------------------------------------- 1 | (2008..2121).each {|year| puts "25 Dec #{year}" if Time.local(year, 12, 25).sunday?} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Delete-a-file/delete-a-file.rb: -------------------------------------------------------------------------------- 1 | File.delete("output.txt", "/output.txt") 2 | Dir.delete("docs") 3 | Dir.delete("/docs") 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Detect-division-by-zero/detect-division-by-zero-2.rb: -------------------------------------------------------------------------------- 1 | irb(main):010:0> div_check(5, 0) 2 | => true 3 | irb(main):011:0> div_check(5.0, 0) 4 | => false 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Detect-division-by-zero/detect-division-by-zero-4.rb: -------------------------------------------------------------------------------- 1 | irb(main):010:0> div_check(5, 0) 2 | => true 3 | irb(main):011:0> div_check(5.0, 0) 4 | => true 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Determine-if-a-string-is-numeric/determine-if-a-string-is-numeric-2.rb: -------------------------------------------------------------------------------- 1 | def is_numeric?(s) 2 | !!Float(s) rescue false 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Dot-product/dot-product-1.rb: -------------------------------------------------------------------------------- 1 | irb(main):001:0> require 'matrix' 2 | => true 3 | irb(main):002:0> Vector[1, 3, -5].inner_product Vector[4, -2, -1] 4 | => 3 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Empty-string/empty-string-1.rb: -------------------------------------------------------------------------------- 1 | s = "" 2 | s = String.new 3 | s = "any string"; s.clear 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Empty-string/empty-string-2.rb: -------------------------------------------------------------------------------- 1 | s == "" 2 | s.eql?("") 3 | s.empty? 4 | s.length == 0 5 | s[/\A\z/] 6 | 7 | # also silly things like 8 | s.each_char.to_a.empty? 9 | -------------------------------------------------------------------------------- /test_data/Ruby/Empty-string/empty-string-3.rb: -------------------------------------------------------------------------------- 1 | s != "" 2 | s.length > 0 3 | s[/./m] 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Empty-string/empty-string-4.rb: -------------------------------------------------------------------------------- 1 | if s then puts "not empty" end # This code is wrong! 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Environment-variables/environment-variables.rb: -------------------------------------------------------------------------------- 1 | ENV['HOME'] 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Evaluate-binomial-coefficients/evaluate-binomial-coefficients-2.rb: -------------------------------------------------------------------------------- 1 | def c n, r 2 | (0...r).inject(1) do |m,i| (m * (n - i)) / (i + 1) end 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Evaluate-binomial-coefficients/evaluate-binomial-coefficients-3.rb: -------------------------------------------------------------------------------- 1 | (1..60).to_a.combination(30).size #=> 118264581564861424 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Even-or-odd/even-or-odd-1.rb: -------------------------------------------------------------------------------- 1 | print "evens: " 2 | p -5.upto(5).select(&:even?) 3 | print "odds: " 4 | p -5.upto(5).select(&:odd?) 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Exceptions/exceptions-1.rb: -------------------------------------------------------------------------------- 1 | # define an exception 2 | class SillyError < Exception 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Exceptions/exceptions-2.rb: -------------------------------------------------------------------------------- 1 | class MyInvalidArgument < ArgumentError 2 | end 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Exceptions/exceptions-5.rb: -------------------------------------------------------------------------------- 1 | # short way to rescue any StandardError 2 | quotient = 1 / 0 rescue "sorry" 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Exceptions/exceptions-6.rb: -------------------------------------------------------------------------------- 1 | def foo 2 | throw :done 3 | end 4 | 5 | catch :done do 6 | foo 7 | end 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Factors-of-an-integer/factors-of-an-integer-1.rb: -------------------------------------------------------------------------------- 1 | class Integer 2 | def factors() (1..self).select { |n| (self % n).zero? } end 3 | end 4 | p 45.factors 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Fibonacci-sequence/fibonacci-sequence-5.rb: -------------------------------------------------------------------------------- 1 | fib = Enumerator.new do |y| 2 | f0, f1 = 0, 1 3 | loop do 4 | y << f0 5 | f0, f1 = f1, f0 + f1 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Fibonacci-sequence/fibonacci-sequence-7.rb: -------------------------------------------------------------------------------- 1 | def fib_gen 2 | a, b = 1, 1 3 | lambda {ret, a, b = a, b, a+b; ret} 4 | end 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Fibonacci-sequence/fibonacci-sequence-8.rb: -------------------------------------------------------------------------------- 1 | def fib 2 | phi = (1 + Math.sqrt(5)) / 2 3 | ((phi**self - (-1 / phi)**self) / Math.sqrt(5)).to_i 4 | end 5 | -------------------------------------------------------------------------------- /test_data/Ruby/File-input-output/file-input-output-1.rb: -------------------------------------------------------------------------------- 1 | str = File.open('input.txt', 'rb') {|f| f.read} 2 | File.open('output.txt', 'wb') {|f| f.write str} 3 | -------------------------------------------------------------------------------- /test_data/Ruby/File-input-output/file-input-output-3.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | FileUtils.copy_file 'input.txt', 'output.txt' 3 | -------------------------------------------------------------------------------- /test_data/Ruby/File-size/file-size.rb: -------------------------------------------------------------------------------- 1 | size = File.size('input.txt') 2 | size = File.size('/input.txt') 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Filter/filter-2.rb: -------------------------------------------------------------------------------- 1 | ary = [1, 2, 3, 4, 5, 6] 2 | ary.select! {|elem| elem.even?} 3 | p ary # => [2, 4, 6] 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Find-limit-of-recursion/find-limit-of-recursion-1.rb: -------------------------------------------------------------------------------- 1 | def recurse x 2 | puts x 3 | recurse(x+1) 4 | end 5 | 6 | recurse(0) 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Find-limit-of-recursion/find-limit-of-recursion-2.rb: -------------------------------------------------------------------------------- 1 | def recurse n 2 | recurse(n+1) 3 | rescue SystemStackError 4 | n 5 | end 6 | 7 | puts recurse(0) 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Flatten-a-list/flatten-a-list-1.rb: -------------------------------------------------------------------------------- 1 | flat = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []].flatten 2 | p flat # => [1, 2, 3, 4, 5, 6, 7, 8] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Flatten-a-list/flatten-a-list-2.rb: -------------------------------------------------------------------------------- 1 | p flatten_once = [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []].flatten(1) 2 | # => [1, 2, [3, 4], 5, [[]], [[6]], 7, 8] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Forward-difference/forward-difference-2.rb: -------------------------------------------------------------------------------- 1 | p dif([1, 23, 45, 678]) # => [22, 22, 633] 2 | p difn([1, 23, 45, 678], 2) # => [0, 611] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Function-definition/function-definition.rb: -------------------------------------------------------------------------------- 1 | def multiply(a, b) 2 | a * b 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Generate-lower-case-ASCII-alphabet/generate-lower-case-ascii-alphabet.rb: -------------------------------------------------------------------------------- 1 | p ('a' .. 'z').to_a 2 | p [*'a' .. 'z'] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Generic-swap/generic-swap-1.rb: -------------------------------------------------------------------------------- 1 | a, b = b, a 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Generic-swap/generic-swap-2.rb: -------------------------------------------------------------------------------- 1 | def swap(a, b) 2 | return b, a 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Generic-swap/generic-swap-3.rb: -------------------------------------------------------------------------------- 1 | x = 42 2 | y = "string" 3 | x, y = swap x, y 4 | puts x # prints string 5 | puts y # prints 42 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Greatest-common-divisor/greatest-common-divisor-1.rb: -------------------------------------------------------------------------------- 1 | irb(main):001:0> 40902.gcd(24140) 2 | => 34 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Greatest-common-divisor/greatest-common-divisor-2.rb: -------------------------------------------------------------------------------- 1 | def gcd(u, v) 2 | u, v = u.abs, v.abs 3 | while v > 0 4 | u, v = v, u % v 5 | end 6 | u 7 | end 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Greatest-element-of-a-list/greatest-element-of-a-list.rb: -------------------------------------------------------------------------------- 1 | values.max 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Guess-the-number/guess-the-number.rb: -------------------------------------------------------------------------------- 1 | n = rand(1..10) 2 | puts 'Guess the number: ' 3 | puts 'Wrong! Guess again: ' until gets.to_i == n 4 | puts 'Well guessed!' 5 | -------------------------------------------------------------------------------- /test_data/Ruby/HTTP/http-1.rb: -------------------------------------------------------------------------------- 1 | require 'open-uri' 2 | 3 | print open("http://rosettacode.org") {|f| f.read} 4 | -------------------------------------------------------------------------------- /test_data/Ruby/HTTP/http-2.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | require 'open-uri' 3 | 4 | open("http://rosettacode.org/") {|f| FileUtils.copy_stream(f, $stdout)} 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Happy-numbers/happy-numbers-3.rb: -------------------------------------------------------------------------------- 1 | [1, 7, 10, 13, 19, 23, 28, 31] 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hash-from-two-arrays/hash-from-two-arrays-3.rb: -------------------------------------------------------------------------------- 1 | keys = ['hal', 666, [1,2,3]] 2 | vals = ['ibm', 'devil', 123] 3 | 4 | keys.zip(vals).to_h 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Graphical/hello-world-graphical-6.rb: -------------------------------------------------------------------------------- 1 | require 'win32ole' 2 | WIN32OLE.new('WScript.Shell').popup("Hello world") 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Line-printer/hello-world-line-printer.rb: -------------------------------------------------------------------------------- 1 | open("| lpr", "w") { |f| f.puts "Hello World!" } 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Standard-error/hello-world-standard-error-1.rb: -------------------------------------------------------------------------------- 1 | $stderr.puts "Goodbye, World!" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Standard-error/hello-world-standard-error-2.rb: -------------------------------------------------------------------------------- 1 | warn "Goodbye, World!" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Text/hello-world-text-1.rb: -------------------------------------------------------------------------------- 1 | puts "Hello world!" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Text/hello-world-text-2.rb: -------------------------------------------------------------------------------- 1 | $stdout.puts "Hello world!" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Text/hello-world-text-3.rb: -------------------------------------------------------------------------------- 1 | STDOUT.write "Hello world!\n" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Text/hello-world-text-4.rb: -------------------------------------------------------------------------------- 1 | $>.puts "Hello world!" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Hello-world-Text/hello-world-text-5.rb: -------------------------------------------------------------------------------- 1 | $>.write "Hello world!\n" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Higher-order-functions/higher-order-functions-1.rb: -------------------------------------------------------------------------------- 1 | succ = proc{|x| x+1} 2 | def to2(&f) 3 | f[2] 4 | end 5 | 6 | to2(&succ) #=> 3 7 | to2{|x| x+1} #=> 3 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Increment-a-numerical-string/increment-a-numerical-string.rb: -------------------------------------------------------------------------------- 1 | '1234'.succ #=> '1235' 2 | '99'.succ #=> '100' 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Infinity/infinity-2.rb: -------------------------------------------------------------------------------- 1 | a = Float::INFINITY # => Infinity 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Input-loop/input-loop-1.rb: -------------------------------------------------------------------------------- 1 | stream = $stdin 2 | stream.each do |line| 3 | # process line 4 | end 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Input-loop/input-loop-2.rb: -------------------------------------------------------------------------------- 1 | # Create an array of lengths of every line. 2 | ary = stream.map {|line| line.chomp.length} 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Jensens-Device/jensens-device-2.rb: -------------------------------------------------------------------------------- 1 | def sum2(lo, hi) 2 | lo.upto(hi).inject(0.0) {|sum, n| sum += yield n} 3 | end 4 | p sum2(1, 100) {|i| 1.0/i} # => 5.18737751763962 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Leap-year/leap-year.rb: -------------------------------------------------------------------------------- 1 | require 'date' 2 | 3 | Date.leap?(year) 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Least-common-multiple/least-common-multiple-1.rb: -------------------------------------------------------------------------------- 1 | irb(main):001:0> 12.lcm 18 2 | => 36 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Literals-String/literals-string-1.rb: -------------------------------------------------------------------------------- 1 | 'single quotes with \'embedded quote\' and \\backslash' 2 | %q(not interpolating with (nested) parentheses 3 | and newline) 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Loop-over-multiple-arrays-simultaneously/loop-over-multiple-arrays-simultaneously-1.rb: -------------------------------------------------------------------------------- 1 | ['a','b','c'].zip(['A','B','C'], [1,2,3]) {|i,j,k| puts "#{i}#{j}#{k}"} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loop-over-multiple-arrays-simultaneously/loop-over-multiple-arrays-simultaneously-2.rb: -------------------------------------------------------------------------------- 1 | ['a','b','c'].zip(['A','B','C'], [1,2,3]) {|a| puts a.join} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Break/loops-break-2.rb: -------------------------------------------------------------------------------- 1 | loop do 2 | print a = rand(20) 3 | puts or break if a == 10 4 | puts "\t#{rand(20)}" 5 | end 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Continue/loops-continue-1.rb: -------------------------------------------------------------------------------- 1 | for i in 1..10 do 2 | print i 3 | if i % 5 == 0 then 4 | puts 5 | next 6 | end 7 | print ', ' 8 | end 9 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Continue/loops-continue-2.rb: -------------------------------------------------------------------------------- 1 | (1..10).each do |i| ... 2 | 1.upto(10) do |i| ... 3 | 10.times do |n| i=n+1; ... 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Continue/loops-continue-3.rb: -------------------------------------------------------------------------------- 1 | (1..10).each_slice(5){|ar| puts ar.join(", ")} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Do-while/loops-do-while-1.rb: -------------------------------------------------------------------------------- 1 | val = 0 2 | begin 3 | val += 1 4 | puts val 5 | end while val % 6 != 0 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Do-while/loops-do-while-2.rb: -------------------------------------------------------------------------------- 1 | val = 0 2 | begin 3 | val += 1 4 | puts val 5 | end until val % 6 == 0 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Do-while/loops-do-while-3.rb: -------------------------------------------------------------------------------- 1 | val = 0 2 | loop do 3 | val += 1 4 | puts val 5 | break unless val %6 != 0 6 | end 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Do-while/loops-do-while-4.rb: -------------------------------------------------------------------------------- 1 | val = 0 2 | loop do 3 | val += 1 4 | puts val 5 | break if val %6 == 0 6 | end 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Downward-for/loops-downward-for.rb: -------------------------------------------------------------------------------- 1 | 10.downto(0) do |i| 2 | puts i 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For-with-a-specified-step/loops-for-with-a-specified-step-1.rb: -------------------------------------------------------------------------------- 1 | 2.step(8,2) {|n| print "#{n}, "} 2 | puts "who do we appreciate?" 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For-with-a-specified-step/loops-for-with-a-specified-step-2.rb: -------------------------------------------------------------------------------- 1 | (2..8).step(2) {|n| print "#{n}, "} 2 | puts "who do we appreciate?" 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For-with-a-specified-step/loops-for-with-a-specified-step-3.rb: -------------------------------------------------------------------------------- 1 | for n in (2..8).step(2) 2 | print "#{n}, " 3 | end 4 | puts "who do we appreciate?" 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For/loops-for-1.rb: -------------------------------------------------------------------------------- 1 | for i in 1..5 2 | for j in 1..i 3 | print "*" 4 | end 5 | puts 6 | end 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For/loops-for-2.rb: -------------------------------------------------------------------------------- 1 | (1..5).each do |i| 2 | (1..i).each do |j| 3 | print "*" 4 | end 5 | puts 6 | end 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For/loops-for-3.rb: -------------------------------------------------------------------------------- 1 | 1.upto(5) do |i| 2 | 1.upto(i) do |j| 3 | print "*" 4 | end 5 | puts 6 | end 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For/loops-for-4.rb: -------------------------------------------------------------------------------- 1 | 5.times do |i| 2 | # i goes from 0 to 4 3 | (i+1).times do 4 | print "*" 5 | end 6 | puts 7 | end 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-For/loops-for-6.rb: -------------------------------------------------------------------------------- 1 | puts (1..5).map { |i| "*" * i } 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Foreach/loops-foreach-1.rb: -------------------------------------------------------------------------------- 1 | for i in collection do 2 | puts i 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Foreach/loops-foreach-2.rb: -------------------------------------------------------------------------------- 1 | collection.each do |i| 2 | puts i 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-Infinite/loops-infinite.rb: -------------------------------------------------------------------------------- 1 | loop {puts "SPAM"} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-N-plus-one-half/loops-n-plus-one-half-1.rb: -------------------------------------------------------------------------------- 1 | (1..10).each do |i| 2 | print i 3 | break if i == 10 4 | print ", " 5 | end 6 | puts 7 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-N-plus-one-half/loops-n-plus-one-half-2.rb: -------------------------------------------------------------------------------- 1 | puts (1..10).join(", ") 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-While/loops-while-1.rb: -------------------------------------------------------------------------------- 1 | i = 1024 2 | while i > 0 do 3 | puts i 4 | i /= 2 5 | end 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-While/loops-while-2.rb: -------------------------------------------------------------------------------- 1 | puts i = 1024 2 | puts i /= 2 while i > 0 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Loops-While/loops-while-3.rb: -------------------------------------------------------------------------------- 1 | i = 1024 2 | until i <= 0 do 3 | puts i 4 | i /= 2 5 | end 6 | -------------------------------------------------------------------------------- /test_data/Ruby/Matrix-transposition/matrix-transposition-3.rb: -------------------------------------------------------------------------------- 1 | def transpose(m) 2 | m[0].zip(*m[1..-1]) 3 | end 4 | p transpose([[1,2,3],[4,5,6]]) 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Palindrome-detection/palindrome-detection-1.rb: -------------------------------------------------------------------------------- 1 | def palindrome?(s) 2 | s == s.reverse 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Parsing-RPN-calculator-algorithm/parsing-rpn-calculator-algorithm.rb: -------------------------------------------------------------------------------- 1 | rpn = RPNExpression("3 4 2 * 1 5 - 2 3 ^ ^ / +") 2 | value = rpn.eval 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Perfect-numbers/perfect-numbers-1.rb: -------------------------------------------------------------------------------- 1 | def perf(n) 2 | sum = 0 3 | for i in 1...n 4 | sum += i if n % i == 0 5 | end 6 | sum == n 7 | end 8 | -------------------------------------------------------------------------------- /test_data/Ruby/Perfect-numbers/perfect-numbers-2.rb: -------------------------------------------------------------------------------- 1 | def perf(n) 2 | n == (1...n).select {|i| n % i == 0}.inject(:+) 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Perfect-numbers/perfect-numbers-4.rb: -------------------------------------------------------------------------------- 1 | for n in 1..10000 2 | puts n if perf(n) 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Permutations/permutations.rb: -------------------------------------------------------------------------------- 1 | p [1,2,3].permutation.to_a 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Pick-random-element/pick-random-element.rb: -------------------------------------------------------------------------------- 1 | irb(main):001:0> %w(north east south west).sample 2 | => "west" 3 | irb(main):002:0> (1..100).to_a.sample(2) 4 | => [17, 79] 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Primality-by-trial-division/primality-by-trial-division-4.rb: -------------------------------------------------------------------------------- 1 | def isprime(n) 2 | '1'*n !~ /^1?$|^(11+?)\1+$/ 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Program-name/program-name.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts "Path: #{$PROGRAM_NAME}" # or puts "Path: #{$0}" 4 | puts "Name: #{File.basename $0}" 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Program-termination/program-termination-1.rb: -------------------------------------------------------------------------------- 1 | if problem 2 | exit(1) 3 | end 4 | 5 | # or 6 | if problem 7 | abort # equivalent to exit(1) 8 | end 9 | -------------------------------------------------------------------------------- /test_data/Ruby/Program-termination/program-termination-2.rb: -------------------------------------------------------------------------------- 1 | if problem 2 | exit! # default value 1 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Quine/quine-1.rb: -------------------------------------------------------------------------------- 1 | x = "x = %p; puts x %% x"; puts x % x 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Quine/quine-2.rb: -------------------------------------------------------------------------------- 1 | puts < "I AM a string" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Repeat-a-string/repeat-a-string.rb: -------------------------------------------------------------------------------- 1 | "ha" * 5 # ==> "hahahahaha" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Return-multiple-values/return-multiple-values-1.rb: -------------------------------------------------------------------------------- 1 | def addsub(x, y) 2 | [x + y, x - y] 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Return-multiple-values/return-multiple-values-2.rb: -------------------------------------------------------------------------------- 1 | def addsub(x, y) 2 | return x + y, x - y 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Return-multiple-values/return-multiple-values-3.rb: -------------------------------------------------------------------------------- 1 | sum, difference = addsub(33, 12) 2 | puts "33 + 12 = #{sum}" 3 | puts "33 - 12 = #{difference}" 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Reverse-a-string/reverse-a-string-1.rb: -------------------------------------------------------------------------------- 1 | str = "asdf" 2 | reversed = str.reverse 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Reverse-a-string/reverse-a-string-2.rb: -------------------------------------------------------------------------------- 1 | #encoding: utf-8 2 | "résumé niño".reverse #=> "oñin émusér" 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Show-the-epoch/show-the-epoch.rb: -------------------------------------------------------------------------------- 1 | irb(main):001:0> Time.at(0).utc 2 | => 1970-01-01 00:00:00 UTC 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Sieve-of-Eratosthenes/sieve-of-eratosthenes-4.rb: -------------------------------------------------------------------------------- 1 | require 'prime' 2 | p Prime::EratosthenesGenerator.new.take_while {|i| i <= 100} 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Stack/stack-1.rb: -------------------------------------------------------------------------------- 1 | stack = [] 2 | stack.push(value) # pushing 3 | value = stack.pop # popping 4 | stack.empty? # is empty? 5 | -------------------------------------------------------------------------------- /test_data/Ruby/String-case/string-case-2.rb: -------------------------------------------------------------------------------- 1 | 'ĥåçýджк'.upcase # => "ĤÅÇÝДЖК" 2 | -------------------------------------------------------------------------------- /test_data/Ruby/String-length/string-length-1.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | puts "あいうえお".bytesize 4 | # => 15 5 | -------------------------------------------------------------------------------- /test_data/Ruby/String-length/string-length-2.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | puts "あいうえお".length 4 | # => 5 5 | 6 | puts "あいうえお".size # alias for length 7 | # => 5 8 | -------------------------------------------------------------------------------- /test_data/Ruby/String-length/string-length-3.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: iso-8859-1 -*- 2 | s = "møøse" 3 | puts "Byte length: %d" % s.bytesize 4 | puts "Character length: %d" % s.length 5 | -------------------------------------------------------------------------------- /test_data/Ruby/String-length/string-length-4.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | s = "møøse" 3 | puts "Byte length: %d" % s.bytesize 4 | puts "Character length: %d" % s.length 5 | -------------------------------------------------------------------------------- /test_data/Ruby/String-length/string-length-5.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: gb18030 -*- 2 | s = "møøse" 3 | puts "Byte length: %d" % s.bytesize 4 | puts "Character length: %d" % s.length 5 | -------------------------------------------------------------------------------- /test_data/Ruby/Sum-and-product-of-an-array/sum-and-product-of-an-array-4.rb: -------------------------------------------------------------------------------- 1 | arr = [1,2,3,4,5] 2 | p sum = arr.sum #=> 15 3 | p [].sum #=> 0 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Sum-digits-of-an-integer/sum-digits-of-an-integer-2.rb: -------------------------------------------------------------------------------- 1 | def sumDigits(num, base = 10) 2 | num.digits(base).sum 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Sum-of-a-series/sum-of-a-series.rb: -------------------------------------------------------------------------------- 1 | puts (1..1000).inject{|sum, x| sum + 1.0 / x ** 2} 2 | #=> 1.64393456668156 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Sum-of-squares/sum-of-squares-1.rb: -------------------------------------------------------------------------------- 1 | [3,1,4,1,5,9].reduce(0){|sum,x| sum + x*x} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Sum-of-squares/sum-of-squares-2.rb: -------------------------------------------------------------------------------- 1 | [3,1,4,1,5,9].map{|x| x*x}.sum(0) 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Tokenize-a-string/tokenize-a-string.rb: -------------------------------------------------------------------------------- 1 | puts "Hello,How,Are,You,Today".split(',').join('.') 2 | -------------------------------------------------------------------------------- /test_data/Ruby/URL-decoding/url-decoding-1.rb: -------------------------------------------------------------------------------- 1 | require 'cgi' 2 | puts CGI.unescape("http%3A%2F%2Ffoo%20bar%2F") 3 | # => "http://foo bar/" 4 | -------------------------------------------------------------------------------- /test_data/Ruby/URL-decoding/url-decoding-2.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | puts URI.decode_www_form_component("http%3A%2F%2Ffoo%20bar%2F") 3 | # => "http://foo bar/" 4 | -------------------------------------------------------------------------------- /test_data/Ruby/URL-encoding/url-encoding-1.rb: -------------------------------------------------------------------------------- 1 | require 'cgi' 2 | puts CGI.escape("http://foo bar/").gsub("+", "%20") 3 | # => "http%3A%2F%2Ffoo%20bar%2F" 4 | -------------------------------------------------------------------------------- /test_data/Ruby/URL-encoding/url-encoding-2.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | puts URI.encode_www_form_component("http://foo bar/").gsub("+", "%20") 3 | # => "http%3A%2F%2Ffoo%20bar%2F" 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Unix-ls/unix-ls.rb: -------------------------------------------------------------------------------- 1 | Dir.foreach("./"){|n| puts n} 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Variadic-function/variadic-function-1.rb: -------------------------------------------------------------------------------- 1 | def print_all(*things) 2 | puts things 3 | end 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Variadic-function/variadic-function-2.rb: -------------------------------------------------------------------------------- 1 | print_all(4, 3, 5, 6, 4, 3) 2 | print_all(4, 3, 5) 3 | print_all("Rosetta", "Code", "Is", "Awesome!") 4 | -------------------------------------------------------------------------------- /test_data/Ruby/Variadic-function/variadic-function-3.rb: -------------------------------------------------------------------------------- 1 | args = ["Rosetta", "Code", "Is", "Awesome!"] 2 | print_all(*args) 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Walk-a-directory-Recursively/walk-a-directory-recursively-2.rb: -------------------------------------------------------------------------------- 1 | puts Dir['**/*.mp3'] 2 | -------------------------------------------------------------------------------- /test_data/Ruby/Web-scraping/web-scraping-2.rb: -------------------------------------------------------------------------------- 1 | require 'open-uri' 2 | puts URI.parse('http://tycho.usno.navy.mil/cgi-bin/timer.pl').read.match(/ (\d{1,2}:\d{1,2}:\d{1,2}) UTC/)[1] 3 | -------------------------------------------------------------------------------- /test_data/Ruby/Y-combinator/y-combinator-4.rb: -------------------------------------------------------------------------------- 1 | y = lambda do |f| 2 | lambda {|*args| f[y[f]][*args]} 3 | end 4 | -------------------------------------------------------------------------------- /training_data/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waingram/code-embeddings/8c656a918be4a0cad035bff8144d93892c677a24/training_data/.keep -------------------------------------------------------------------------------- /training_data/rosettaJavaCorpus.src: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waingram/code-embeddings/8c656a918be4a0cad035bff8144d93892c677a24/training_data/rosettaJavaCorpus.src --------------------------------------------------------------------------------