From 80737d5a6a2c2aed07db7e7ef605fa447cd4567f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingy=20d=C3=B6t=20Net?= Date: Tue, 9 Apr 2013 00:46:50 -0700 Subject: [PATCH] new tasks --- Conf/task.yaml | 28 +- Lang/AWK/Ackermann_function | 1 + Lang/AWK/Arrays | 1 + Lang/AWK/Balanced_brackets | 1 + Lang/AWK/Best_shuffle | 1 + Lang/AWK/Binary_digits | 1 + Lang/AWK/Binary_search | 1 + Lang/AWK/Caesar_cipher | 1 + Lang/AWK/Collections | 1 + Lang/AWK/Delete_a_file | 1 + Lang/AWK/Determine_if_a_string_is_numeric | 1 + Lang/ActionScript/Ackermann_function | 1 + Lang/ActionScript/Arrays | 1 + Lang/ActionScript/Classes | 1 + .../Determine_if_a_string_is_numeric | 1 + Lang/BASIC/Ackermann_function | 1 + Lang/BASIC/Arrays | 1 + Lang/BASIC/Balanced_brackets | 1 + Lang/BASIC/Binary_search | 1 + Lang/BASIC/Binary_strings | 1 + Lang/BASIC/Check_that_file_exists | 1 + Lang/BASIC/Classes | 1 + Lang/BASIC/Color_of_a_screen_pixel | 1 + Lang/BASIC/Delete_a_file | 1 + Lang/BASIC/Determine_if_a_string_is_numeric | 1 + Lang/Babel/Ackermann_function | 1 + Lang/Befunge/Ackermann_function | 1 + Lang/Befunge/Balanced_brackets | 1 + Lang/C/Ackermann_function | 1 + Lang/C/Arrays | 1 + Lang/C/Assertions | 1 + Lang/C/Balanced_brackets | 1 + Lang/C/Best_shuffle | 1 + Lang/C/Binary_digits | 1 + Lang/C/Binary_search | 1 + Lang/C/Binary_strings | 1 + Lang/C/Caesar_cipher | 1 + Lang/C/Calendar | 1 + Lang/C/Check_that_file_exists | 1 + Lang/C/Checkpoint_synchronization | 1 + Lang/C/Classes | 1 + Lang/C/Collections | 1 + Lang/C/Color_of_a_screen_pixel | 1 + Lang/C/Delegates | 1 + Lang/C/Delete_a_file | 1 + Lang/C/Detect_division_by_zero | 1 + Lang/C/Determine_if_a_string_is_numeric | 1 + Lang/C/Forest_fire | 1 + Lang/Clojure/Ackermann_function | 1 + Lang/Clojure/Arrays | 1 + Lang/Clojure/Assertions | 1 + Lang/Clojure/Balanced_brackets | 1 + Lang/Clojure/Best_shuffle | 1 + Lang/Clojure/Binary_digits | 1 + Lang/Clojure/Binary_search | 1 + Lang/Clojure/Caesar_cipher | 1 + Lang/Clojure/Check_that_file_exists | 1 + Lang/Clojure/Closest-pair_problem | 1 + Lang/Clojure/Collections | 1 + Lang/Clojure/Color_of_a_screen_pixel | 1 + Lang/Clojure/Delete_a_file | 1 + Lang/Clojure/Detect_division_by_zero | 1 + Lang/Clojure/Determine_if_a_string_is_numeric | 1 + Lang/Clojure/Forest_fire | 1 + Lang/CoffeeScript/Ackermann_function | 1 + Lang/CoffeeScript/Arrays | 1 + Lang/CoffeeScript/Balanced_brackets | 1 + Lang/CoffeeScript/Binary_digits | 1 + Lang/CoffeeScript/Binary_search | 1 + Lang/CoffeeScript/Caesar_cipher | 1 + Lang/CoffeeScript/Classes | 1 + Lang/CoffeeScript/Delegates | 1 + .../Determine_if_a_string_is_numeric | 1 + Lang/Dylan/Ackermann_function | 1 + Lang/Eiffel/Ackermann_function | 1 + Lang/Eiffel/Arrays | 1 + Lang/Eiffel/Assertions | 1 + Lang/Eiffel/Detect_division_by_zero | 1 + Lang/Erlang/Ackermann_function | 1 + Lang/Erlang/Arrays | 1 + Lang/Erlang/Assertions | 1 + Lang/Erlang/Balanced_ternary | 1 + Lang/Erlang/Binary_digits | 1 + Lang/Erlang/Binary_search | 1 + Lang/Erlang/Caesar_cipher | 1 + Lang/Erlang/Check_that_file_exists | 1 + Lang/Erlang/Delete_a_file | 1 + Lang/Erlang/Detect_division_by_zero | 1 + Lang/Erlang/Determine_if_a_string_is_numeric | 1 + Lang/Forth/Ackermann_function | 1 + Lang/Forth/Arrays | 1 + Lang/Forth/Balanced_brackets | 1 + Lang/Forth/Binary_digits | 1 + Lang/Forth/Binary_search | 1 + Lang/Forth/Binary_strings | 1 + Lang/Forth/Caesar_cipher | 1 + Lang/Forth/Check_that_file_exists | 1 + Lang/Forth/Classes | 1 + Lang/Forth/Collections | 1 + Lang/Forth/Delete_a_file | 1 + Lang/Forth/Detect_division_by_zero | 1 + Lang/Forth/Determine_if_a_string_is_numeric | 1 + Lang/Fortran/Ackermann_function | 1 + Lang/Fortran/Arrays | 1 + Lang/Fortran/Binary_search | 1 + Lang/Fortran/Caesar_cipher | 1 + Lang/Fortran/Check_that_file_exists | 1 + Lang/Fortran/Define_a_primitive_data_type | 1 + Lang/Fortran/Delete_a_file | 1 + Lang/Fortran/Determine_if_a_string_is_numeric | 1 + Lang/Fortran/Forest_fire | 1 + Lang/Go/Ackermann_function | 1 + Lang/Go/Arrays | 1 + Lang/Go/Assertions | 1 + Lang/Go/Balanced_brackets | 1 + Lang/Go/Balanced_ternary | 1 + Lang/Go/Best_shuffle | 1 + Lang/Go/Binary_digits | 1 + Lang/Go/Binary_search | 1 + Lang/Go/Binary_strings | 1 + Lang/Go/Caesar_cipher | 1 + Lang/Go/Check_that_file_exists | 1 + Lang/Go/Checkpoint_synchronization | 1 + Lang/Go/Classes | 1 + Lang/Go/Closest-pair_problem | 1 + Lang/Go/Collections | 1 + Lang/Go/Deepcopy | 1 + Lang/Go/Delegates | 1 + Lang/Go/Delete_a_file | 1 + Lang/Go/Detect_division_by_zero | 1 + Lang/Go/Determine_if_a_string_is_numeric | 1 + Lang/Go/Forest_fire | 1 + Lang/Haskell/Ackermann_function | 1 + Lang/Haskell/Arrays | 1 + Lang/Haskell/Assertions | 1 + Lang/Haskell/Balanced_brackets | 1 + Lang/Haskell/Balanced_ternary | 1 + Lang/Haskell/Best_shuffle | 1 + Lang/Haskell/Binary_digits | 1 + Lang/Haskell/Binary_search | 1 + Lang/Haskell/Binary_strings | 1 + Lang/Haskell/Caesar_cipher | 1 + Lang/Haskell/Check_that_file_exists | 1 + Lang/Haskell/Checkpoint_synchronization | 1 + Lang/Haskell/Classes | 1 + Lang/Haskell/Closest-pair_problem | 1 + Lang/Haskell/Collections | 1 + Lang/Haskell/Define_a_primitive_data_type | 1 + Lang/Haskell/Delete_a_file | 1 + Lang/Haskell/Detect_division_by_zero | 1 + Lang/Haskell/Determine_if_a_string_is_numeric | 1 + Lang/Haskell/Forest_fire | 1 + Lang/Java/Ackermann_function | 1 + Lang/Java/Arrays | 1 + Lang/Java/Assertions | 1 + Lang/Java/Balanced_brackets | 1 + Lang/Java/Best_shuffle | 1 + Lang/Java/Binary_digits | 1 + Lang/Java/Binary_search | 1 + Lang/Java/Caesar_cipher | 1 + Lang/Java/Check_that_file_exists | 1 + Lang/Java/Checkpoint_synchronization | 1 + Lang/Java/Classes | 1 + Lang/Java/Closest-pair_problem | 1 + Lang/Java/Collections | 1 + Lang/Java/Color_of_a_screen_pixel | 1 + Lang/Java/Define_a_primitive_data_type | 1 + Lang/Java/Delegates | 1 + Lang/Java/Delete_a_file | 1 + Lang/Java/Detect_division_by_zero | 1 + Lang/Java/Determine_if_a_string_is_numeric | 1 + Lang/Java/Forest_fire | 1 + Lang/JavaScript/Ackermann_function | 1 + Lang/JavaScript/Arrays | 1 + Lang/JavaScript/Balanced_brackets | 1 + Lang/JavaScript/Best_shuffle | 1 + Lang/JavaScript/Binary_digits | 1 + Lang/JavaScript/Binary_search | 1 + Lang/JavaScript/Caesar_cipher | 1 + Lang/JavaScript/Check_that_file_exists | 1 + Lang/JavaScript/Classes | 1 + Lang/JavaScript/Closest-pair_problem | 1 + Lang/JavaScript/Collections | 1 + Lang/JavaScript/Deepcopy | 1 + Lang/JavaScript/Define_a_primitive_data_type | 1 + Lang/JavaScript/Delegates | 1 + Lang/JavaScript/Delete_a_file | 1 + Lang/JavaScript/Detect_division_by_zero | 1 + .../Determine_if_a_string_is_numeric | 1 + Lang/JavaScript/Forest_fire | 1 + Lang/Lua/Ackermann_function | 1 + Lang/Lua/Arrays | 1 + Lang/Lua/Assertions | 1 + Lang/Lua/Balanced_brackets | 1 + Lang/Lua/Binary_search | 1 + Lang/Lua/Binary_strings | 1 + Lang/Lua/Caesar_cipher | 1 + Lang/Lua/Check_that_file_exists | 1 + Lang/Lua/Classes | 1 + Lang/Lua/Collections | 1 + Lang/Lua/Delete_a_file | 1 + Lang/Lua/Detect_division_by_zero | 1 + Lang/Lua/Determine_if_a_string_is_numeric | 1 + Lang/PHP/Ackermann_function | 1 + Lang/PHP/Arrays | 1 + Lang/PHP/Assertions | 1 + Lang/PHP/Best_shuffle | 1 + Lang/PHP/Binary_digits | 1 + Lang/PHP/Binary_search | 1 + Lang/PHP/Caesar_cipher | 1 + Lang/PHP/Check_that_file_exists | 1 + Lang/PHP/Classes | 1 + Lang/PHP/Collections | 1 + Lang/PHP/Color_of_a_screen_pixel | 1 + Lang/PHP/Delegates | 1 + Lang/PHP/Delete_a_file | 1 + Lang/PHP/Detect_division_by_zero | 1 + Lang/PHP/Determine_if_a_string_is_numeric | 1 + Lang/Perl/Ackermann_function | 1 + Lang/Perl/Arrays | 1 + Lang/Perl/Assertions | 1 + Lang/Perl/Balanced_brackets | 1 + Lang/Perl/Best_shuffle | 1 + Lang/Perl/Binary_digits | 1 + Lang/Perl/Binary_search | 1 + Lang/Perl/Caesar_cipher | 1 + Lang/Perl/Calendar | 1 + Lang/Perl/Check_that_file_exists | 1 + Lang/Perl/Checkpoint_synchronization | 1 + Lang/Perl/Classes | 1 + Lang/Perl/Closest-pair_problem | 1 + Lang/Perl/Collections | 1 + Lang/Perl/Define_a_primitive_data_type | 1 + Lang/Perl/Delegates | 1 + Lang/Perl/Delete_a_file | 1 + Lang/Perl/Detect_division_by_zero | 1 + Lang/Perl/Determine_if_a_string_is_numeric | 1 + Lang/Perl/Forest_fire | 1 + Lang/PicoLisp/Ackermann_function | 1 + Lang/PicoLisp/Arrays | 1 + Lang/PicoLisp/Assertions | 1 + Lang/PicoLisp/Balanced_brackets | 1 + Lang/PicoLisp/Best_shuffle | 1 + Lang/PicoLisp/Binary_digits | 1 + Lang/PicoLisp/Binary_search | 1 + Lang/PicoLisp/Binary_strings | 1 + Lang/PicoLisp/Caesar_cipher | 1 + Lang/PicoLisp/Calendar | 1 + Lang/PicoLisp/Check_that_file_exists | 1 + Lang/PicoLisp/Checkpoint_synchronization | 1 + Lang/PicoLisp/Classes | 1 + Lang/PicoLisp/Closest-pair_problem | 1 + Lang/PicoLisp/Collections | 1 + Lang/PicoLisp/Color_of_a_screen_pixel | 1 + Lang/PicoLisp/Define_a_primitive_data_type | 1 + Lang/PicoLisp/Delegates | 1 + Lang/PicoLisp/Delete_a_file | 1 + Lang/PicoLisp/Detect_division_by_zero | 1 + .../PicoLisp/Determine_if_a_string_is_numeric | 1 + Lang/PicoLisp/Forest_fire | 1 + Lang/Prolog/Ackermann_function | 1 + Lang/Prolog/Arrays | 1 + Lang/Prolog/Assertions | 1 + Lang/Prolog/Balanced_brackets | 1 + Lang/Prolog/Balanced_ternary | 1 + Lang/Prolog/Best_shuffle | 1 + Lang/Prolog/Caesar_cipher | 1 + Lang/Python/Ackermann_function | 1 + Lang/Python/Arrays | 1 + Lang/Python/Assertions | 1 + Lang/Python/Balanced_brackets | 1 + Lang/Python/Balanced_ternary | 1 + Lang/Python/Best_shuffle | 1 + Lang/Python/Binary_digits | 1 + Lang/Python/Binary_search | 1 + Lang/Python/Binary_strings | 1 + Lang/Python/Caesar_cipher | 1 + Lang/Python/Calendar | 1 + Lang/Python/Check_that_file_exists | 1 + Lang/Python/Classes | 1 + Lang/Python/Closest-pair_problem | 1 + Lang/Python/Collections | 1 + Lang/Python/Color_of_a_screen_pixel | 1 + Lang/Python/Define_a_primitive_data_type | 1 + Lang/Python/Delegates | 1 + Lang/Python/Delete_a_file | 1 + Lang/Python/Detect_division_by_zero | 1 + Lang/Python/Determine_if_a_string_is_numeric | 1 + Lang/Python/Forest_fire | 1 + Lang/R/Ackermann_function | 1 + Lang/R/Arrays | 1 + Lang/R/Assertions | 1 + Lang/R/Balanced_brackets | 1 + Lang/R/Binary_search | 1 + Lang/R/Check_that_file_exists | 1 + Lang/R/Classes | 1 + Lang/R/Closest-pair_problem | 1 + Lang/R/Collections | 1 + Lang/R/Delete_a_file | 1 + Lang/R/Detect_division_by_zero | 1 + Lang/R/Determine_if_a_string_is_numeric | 1 + Lang/REXX/Ackermann_function | 1 + Lang/REXX/Arrays | 1 + Lang/REXX/Assertions | 1 + Lang/REXX/Balanced_brackets | 1 + Lang/REXX/Balanced_ternary | 1 + Lang/REXX/Best_shuffle | 1 + Lang/REXX/Binary_search | 1 + Lang/REXX/Binary_strings | 1 + Lang/REXX/Caesar_cipher | 1 + Lang/REXX/Calendar | 1 + Lang/REXX/Closest-pair_problem | 1 + Lang/REXX/Collections | 1 + Lang/REXX/Detect_division_by_zero | 1 + Lang/REXX/Determine_if_a_string_is_numeric | 1 + Lang/REXX/Forest_fire | 1 + Lang/Racket/Ackermann_function | 1 + Lang/Racket/Arrays | 1 + Lang/Racket/Assertions | 1 + Lang/Racket/Balanced_brackets | 1 + Lang/Racket/Best_shuffle | 1 + Lang/Racket/Binary_digits | 1 + Lang/Racket/Binary_search | 1 + Lang/Racket/Binary_strings | 1 + Lang/Racket/Caesar_cipher | 1 + Lang/Racket/Classes | 1 + Lang/Racket/Define_a_primitive_data_type | 1 + Lang/Racket/Detect_division_by_zero | 1 + Lang/Racket/Determine_if_a_string_is_numeric | 1 + Lang/Racket/Forest_fire | 1 + Lang/Ruby/Ackermann_function | 1 + Lang/Ruby/Arrays | 1 + Lang/Ruby/Assertions | 1 + Lang/Ruby/Balanced_brackets | 1 + Lang/Ruby/Balanced_ternary | 1 + Lang/Ruby/Binary_search | 1 + Lang/Ruby/Binary_strings | 1 + Lang/Ruby/Caesar_cipher | 1 + Lang/Ruby/Calendar | 1 + Lang/Ruby/Check_that_file_exists | 1 + Lang/Ruby/Checkpoint_synchronization | 1 + Lang/Ruby/Classes | 1 + Lang/Ruby/Closest-pair_problem | 1 + Lang/Ruby/Collections | 1 + Lang/Ruby/Define_a_primitive_data_type | 1 + Lang/Ruby/Delegates | 1 + Lang/Ruby/Delete_a_file | 1 + Lang/Ruby/Detect_division_by_zero | 1 + Lang/Ruby/Determine_if_a_string_is_numeric | 1 + Lang/Ruby/Forest_fire | 1 + Lang/SNUSP/Ackermann_function | 1 + Lang/Sather/Ackermann_function | 1 + Lang/Sather/Arrays | 1 + Lang/Sather/Assertions | 1 + Lang/Sather/Classes | 1 + Lang/Sather/Forest_fire | 1 + Lang/Scala/Ackermann_function | 1 + Lang/Scala/Arrays | 1 + Lang/Scala/Assertions | 1 + Lang/Scala/Balanced_brackets | 1 + Lang/Scala/Binary_search | 1 + Lang/Scala/Caesar_cipher | 1 + Lang/Scala/Calendar | 1 + Lang/Scala/Classes | 1 + Lang/Scala/Closest-pair_problem | 1 + Lang/Scala/Collections | 1 + Lang/Scala/Detect_division_by_zero | 1 + Lang/Scala/Determine_if_a_string_is_numeric | 1 + Lang/Scala/Forest_fire | 1 + Lang/Scheme/Ackermann_function | 1 + Lang/Scheme/Arrays | 1 + Lang/Scheme/Assertions | 1 + Lang/Scheme/Balanced_brackets | 1 + Lang/Scheme/Best_shuffle | 1 + Lang/Scheme/Binary_search | 1 + Lang/Scheme/Check_that_file_exists | 1 + Lang/Scheme/Classes | 1 + Lang/Scheme/Collections | 1 + Lang/Scheme/Delete_a_file | 1 + Lang/Scheme/Determine_if_a_string_is_numeric | 1 + Lang/Smalltalk/Ackermann_function | 1 + Lang/Smalltalk/Arrays | 1 + Lang/Smalltalk/Assertions | 1 + Lang/Smalltalk/Caesar_cipher | 1 + Lang/Smalltalk/Check_that_file_exists | 1 + Lang/Smalltalk/Classes | 1 + Lang/Smalltalk/Collections | 1 + Lang/Smalltalk/Delete_a_file | 1 + Lang/Smalltalk/Detect_division_by_zero | 1 + .../Determine_if_a_string_is_numeric | 1 + Lang/Tcl/Ackermann_function | 1 + Lang/Tcl/Arrays | 1 + Lang/Tcl/Assertions | 1 + Lang/Tcl/Balanced_brackets | 1 + Lang/Tcl/Balanced_ternary | 1 + Lang/Tcl/Best_shuffle | 1 + Lang/Tcl/Binary_search | 1 + Lang/Tcl/Binary_strings | 1 + Lang/Tcl/Caesar_cipher | 1 + Lang/Tcl/Calendar | 1 + Lang/Tcl/Check_that_file_exists | 1 + Lang/Tcl/Checkpoint_synchronization | 1 + Lang/Tcl/Classes | 1 + Lang/Tcl/Closest-pair_problem | 1 + Lang/Tcl/Collections | 1 + Lang/Tcl/Color_of_a_screen_pixel | 1 + Lang/Tcl/Define_a_primitive_data_type | 1 + Lang/Tcl/Delegates | 1 + Lang/Tcl/Delete_a_file | 1 + Lang/Tcl/Detect_division_by_zero | 1 + Lang/Tcl/Determine_if_a_string_is_numeric | 1 + Lang/Tcl/Forest_fire | 1 + Task/Ackermann_function/0DESCRIPTION | 12 + Task/Ackermann_function/1META.yaml | 5 + .../AWK/ackermann_function.awk | 18 ++ .../ActionScript/ackermann_function.as | 13 + .../BASIC/ackermann_function.bas | 12 + .../Babel/ackermann_function.pb | 53 ++++ .../Befunge/ackermann_function.bf | 8 + .../C/ackermann_function-2.c | 41 +++ .../Ackermann_function/C/ackermann_function.c | 18 ++ .../Clojure/ackermann_function.clj | 4 + .../CoffeeScript/ackermann_function.coffee | 4 + .../Dylan/ackermann_function.dylan | 6 + .../Eiffel/ackermann_function.e | 41 +++ .../Erlang/ackermann_function.erl | 11 + .../Forth/ackermann_function-2.fth | 14 + .../Forth/ackermann_function.fth | 5 + .../Fortran/ackermann_function.f | 27 ++ .../Go/ackermann_function-2.go | 15 ++ .../Go/ackermann_function-3.go | 53 ++++ .../Go/ackermann_function.go | 9 + .../Haskell/ackermann_function-2.hs | 9 + .../Haskell/ackermann_function.hs | 3 + .../Java/ackermann_function.java | 8 + .../JavaScript/ackermann_function.js | 4 + .../Lua/ackermann_function.lua | 5 + .../PHP/ackermann_function.php | 15 ++ .../Perl/ackermann_function-2.pl | 6 + .../Perl/ackermann_function-3.pl | 6 + .../Perl/ackermann_function.pl | 13 + .../PicoLisp/ackermann_function.l | 5 + .../Prolog/ackermann_function.pro | 3 + .../Python/ackermann_function-2.py | 7 + .../Python/ackermann_function-3.py | 10 + .../Python/ackermann_function-4.py | 6 + .../Python/ackermann_function.py | 3 + .../R/ackermann_function-2.r | 3 + .../Ackermann_function/R/ackermann_function.r | 9 + .../REXX/ackermann_function-2.rexx | 21 ++ .../REXX/ackermann_function-3.rexx | 36 +++ .../REXX/ackermann_function.rexx | 25 ++ .../Racket/ackermann_function.rkt | 7 + .../Ruby/ackermann_function-2.rb | 4 + .../Ruby/ackermann_function.rb | 9 + .../SNUSP/ackermann_function.snusp | 12 + .../Sather/ackermann_function-2.sa | 19 ++ .../Sather/ackermann_function.sa | 19 ++ .../Scala/ackermann_function-2.scala | 2 + .../Scala/ackermann_function-3.scala | 40 +++ .../Scala/ackermann_function-4.scala | 5 + .../Scala/ackermann_function.scala | 5 + .../Scheme/ackermann_function.ss | 5 + .../Smalltalk/ackermann_function.st | 15 ++ .../Tcl/ackermann_function-2.tcl | 9 + .../Tcl/ackermann_function-3.tcl | 55 ++++ .../Tcl/ackermann_function.tcl | 9 + Task/Arrays/0DESCRIPTION | 13 + Task/Arrays/1META.yaml | 2 + Task/Arrays/AWK/arrays.awk | 30 +++ Task/Arrays/ActionScript/arrays.as | 16 ++ Task/Arrays/BASIC/arrays-2.bas | 1 + Task/Arrays/BASIC/arrays-3.bas | 6 + Task/Arrays/BASIC/arrays-4.bas | 6 + Task/Arrays/BASIC/arrays-5.bas | 1 + Task/Arrays/BASIC/arrays-6.bas | 7 + Task/Arrays/BASIC/arrays-7.bas | 6 + Task/Arrays/BASIC/arrays-8.bas | 9 + Task/Arrays/BASIC/arrays.bas | 2 + Task/Arrays/C/arrays-2.c | 1 + Task/Arrays/C/arrays-3.c | 5 + Task/Arrays/C/arrays-4.c | 11 + Task/Arrays/C/arrays-5.c | 2 + Task/Arrays/C/arrays-6.c | 1 + Task/Arrays/C/arrays-7.c | 3 + Task/Arrays/C/arrays-8.c | 10 + Task/Arrays/C/arrays-9.c | 3 + Task/Arrays/C/arrays.c | 2 + Task/Arrays/Clojure/arrays.clj | 34 +++ Task/Arrays/CoffeeScript/arrays-2.coffee | 1 + Task/Arrays/CoffeeScript/arrays-3.coffee | 3 + Task/Arrays/CoffeeScript/arrays.coffee | 8 + Task/Arrays/Eiffel/arrays.e | 33 +++ Task/Arrays/Erlang/arrays.erl | 30 +++ Task/Arrays/Forth/arrays-2.fth | 20 ++ Task/Arrays/Forth/arrays-3.fth | 15 ++ Task/Arrays/Forth/arrays.fth | 7 + Task/Arrays/Fortran/arrays-10.f | 1 + Task/Arrays/Fortran/arrays-11.f | 1 + Task/Arrays/Fortran/arrays-12.f | 1 + Task/Arrays/Fortran/arrays-13.f | 1 + Task/Arrays/Fortran/arrays-14.f | 1 + Task/Arrays/Fortran/arrays-15.f | 1 + Task/Arrays/Fortran/arrays-16.f | 1 + Task/Arrays/Fortran/arrays-17.f | 2 + Task/Arrays/Fortran/arrays-18.f | 1 + Task/Arrays/Fortran/arrays-19.f | 2 + Task/Arrays/Fortran/arrays-2.f | 1 + Task/Arrays/Fortran/arrays-20.f | 2 + Task/Arrays/Fortran/arrays-21.f | 1 + Task/Arrays/Fortran/arrays-22.f | 1 + Task/Arrays/Fortran/arrays-23.f | 1 + Task/Arrays/Fortran/arrays-24.f | 1 + Task/Arrays/Fortran/arrays-25.f | 1 + Task/Arrays/Fortran/arrays-26.f | 1 + Task/Arrays/Fortran/arrays-27.f | 1 + Task/Arrays/Fortran/arrays-28.f | 1 + Task/Arrays/Fortran/arrays-29.f | 1 + Task/Arrays/Fortran/arrays-3.f | 1 + Task/Arrays/Fortran/arrays-30.f | 1 + Task/Arrays/Fortran/arrays-31.f | 1 + Task/Arrays/Fortran/arrays-32.f | 1 + Task/Arrays/Fortran/arrays-33.f | 1 + Task/Arrays/Fortran/arrays-34.f | 1 + Task/Arrays/Fortran/arrays-35.f | 1 + Task/Arrays/Fortran/arrays-36.f | 1 + Task/Arrays/Fortran/arrays-37.f | 1 + Task/Arrays/Fortran/arrays-38.f | 1 + Task/Arrays/Fortran/arrays-39.f | 1 + Task/Arrays/Fortran/arrays-4.f | 1 + Task/Arrays/Fortran/arrays-40.f | 1 + Task/Arrays/Fortran/arrays-41.f | 1 + Task/Arrays/Fortran/arrays-5.f | 1 + Task/Arrays/Fortran/arrays-6.f | 1 + Task/Arrays/Fortran/arrays-7.f | 1 + Task/Arrays/Fortran/arrays-8.f | 1 + Task/Arrays/Fortran/arrays-9.f | 1 + Task/Arrays/Fortran/arrays.f | 1 + Task/Arrays/Go/arrays.go | 63 +++++ Task/Arrays/Haskell/arrays.hs | 7 + Task/Arrays/Java/arrays-2.java | 4 + Task/Arrays/Java/arrays.java | 3 + Task/Arrays/JavaScript/arrays.js | 19 ++ Task/Arrays/Lua/arrays.lua | 7 + Task/Arrays/PHP/arrays-10.php | 1 + Task/Arrays/PHP/arrays-11.php | 1 + Task/Arrays/PHP/arrays-12.php | 1 + Task/Arrays/PHP/arrays-2.php | 6 + Task/Arrays/PHP/arrays-3.php | 2 + Task/Arrays/PHP/arrays-4.php | 1 + Task/Arrays/PHP/arrays-5.php | 1 + Task/Arrays/PHP/arrays-6.php | 34 +++ Task/Arrays/PHP/arrays-7.php | 1 + Task/Arrays/PHP/arrays-8.php | 1 + Task/Arrays/PHP/arrays-9.php | 1 + Task/Arrays/PHP/arrays.php | 2 + Task/Arrays/Perl/arrays.pl | 8 + Task/Arrays/PicoLisp/arrays-2.l | 2 + Task/Arrays/PicoLisp/arrays-3.l | 2 + Task/Arrays/PicoLisp/arrays-4.l | 2 + Task/Arrays/PicoLisp/arrays.l | 2 + Task/Arrays/Prolog/arrays-2.pro | 8 + Task/Arrays/Prolog/arrays-3.pro | 9 + Task/Arrays/Prolog/arrays.pro | 9 + Task/Arrays/Python/arrays-2.py | 1 + Task/Arrays/Python/arrays-3.py | 1 + Task/Arrays/Python/arrays-4.py | 1 + Task/Arrays/Python/arrays-5.py | 3 + Task/Arrays/Python/arrays-6.py | 9 + Task/Arrays/Python/arrays-7.py | 6 + Task/Arrays/Python/arrays.py | 8 + Task/Arrays/R/arrays.r | 7 + Task/Arrays/REXX/arrays-2.rexx | 13 + Task/Arrays/REXX/arrays-3.rexx | 9 + Task/Arrays/REXX/arrays-4.rexx | 10 + Task/Arrays/REXX/arrays-5.rexx | 16 ++ Task/Arrays/REXX/arrays-6.rexx | 29 ++ Task/Arrays/REXX/arrays.rexx | 9 + Task/Arrays/Racket/arrays.rkt | 12 + Task/Arrays/Ruby/arrays.rb | 20 ++ Task/Arrays/Sather/arrays.sa | 12 + Task/Arrays/Scala/arrays-2.scala | 3 + Task/Arrays/Scala/arrays.scala | 11 + Task/Arrays/Scheme/arrays.ss | 5 + Task/Arrays/Smalltalk/arrays-2.st | 12 + Task/Arrays/Smalltalk/arrays-3.st | 7 + Task/Arrays/Smalltalk/arrays-4.st | 2 + Task/Arrays/Smalltalk/arrays-5.st | 3 + Task/Arrays/Smalltalk/arrays-6.st | 1 + Task/Arrays/Smalltalk/arrays-7.st | 12 + Task/Arrays/Smalltalk/arrays.st | 1 + Task/Arrays/Tcl/arrays-2.tcl | 1 + Task/Arrays/Tcl/arrays.tcl | 8 + Task/Assertions/0DESCRIPTION | 3 + Task/Assertions/1META.yaml | 2 + Task/Assertions/C/assertions-2.c | 1 + Task/Assertions/C/assertions.c | 9 + Task/Assertions/Clojure/assertions.clj | 2 + Task/Assertions/Eiffel/assertions-2.e | 8 + Task/Assertions/Eiffel/assertions.e | 12 + Task/Assertions/Erlang/assertions.erl | 10 + Task/Assertions/Go/assertions.go | 8 + Task/Assertions/Haskell/assertions.hs | 5 + Task/Assertions/Java/assertions.java | 8 + Task/Assertions/Lua/assertions.lua | 3 + Task/Assertions/PHP/assertions.php | 6 + Task/Assertions/Perl/assertions-2.pl | 2 + Task/Assertions/Perl/assertions-3.pl | 9 + Task/Assertions/Perl/assertions-4.pl | 2 + Task/Assertions/Perl/assertions-5.pl | 4 + Task/Assertions/Perl/assertions.pl | 1 + Task/Assertions/PicoLisp/assertions-2.l | 4 + Task/Assertions/PicoLisp/assertions-3.l | 5 + Task/Assertions/PicoLisp/assertions.l | 3 + Task/Assertions/Prolog/assertions.pro | 2 + Task/Assertions/Python/assertions.py | 6 + Task/Assertions/R/assertions.r | 1 + Task/Assertions/REXX/assertions.rexx | 24 ++ Task/Assertions/Racket/assertions-2.rkt | 5 + Task/Assertions/Racket/assertions.rkt | 13 + Task/Assertions/Ruby/assertions.rb | 11 + Task/Assertions/Sather/assertions.sa | 7 + Task/Assertions/Scala/assertions-2.scala | 2 + Task/Assertions/Scala/assertions-3.scala | 4 + Task/Assertions/Scala/assertions.scala | 4 + Task/Assertions/Scheme/assertions.ss | 2 + Task/Assertions/Smalltalk/assertions-2.st | 2 + Task/Assertions/Smalltalk/assertions-3.st | 1 + Task/Assertions/Smalltalk/assertions.st | 3 + Task/Assertions/Tcl/assertions.tcl | 4 + Task/Balanced_brackets/0DESCRIPTION | 10 + .../AWK/balanced_brackets.awk | 21 ++ .../BASIC/balanced_brackets.bas | 57 ++++ .../Befunge/balanced_brackets.bf | 7 + .../Balanced_brackets/C/balanced_brackets-2.c | 9 + Task/Balanced_brackets/C/balanced_brackets.c | 43 +++ .../Clojure/balanced_brackets.clj | 28 ++ .../CoffeeScript/balanced_brackets-2.coffee | 17 ++ .../CoffeeScript/balanced_brackets.coffee | 15 ++ .../Forth/balanced_brackets.fth | 23 ++ .../Balanced_brackets/Go/balanced_brackets.go | 55 ++++ .../Haskell/balanced_brackets-2.hs | 20 ++ .../Haskell/balanced_brackets.hs | 29 ++ .../Java/balanced_brackets.java | 50 ++++ .../JavaScript/balanced_brackets-2.js | 29 ++ .../JavaScript/balanced_brackets.js | 43 +++ .../Lua/balanced_brackets.lua | 20 ++ .../Perl/balanced_brackets-2.pl | 10 + .../Perl/balanced_brackets.pl | 13 + .../PicoLisp/balanced_brackets.l | 17 ++ .../Prolog/balanced_brackets.pro | 52 ++++ .../Python/balanced_brackets.py | 27 ++ .../Balanced_brackets/R/balanced_brackets-2.r | 3 + .../Balanced_brackets/R/balanced_brackets-3.r | 6 + .../Balanced_brackets/R/balanced_brackets-4.r | 11 + Task/Balanced_brackets/R/balanced_brackets.r | 5 + .../REXX/balanced_brackets-2.rexx | 67 +++++ .../REXX/balanced_brackets-3.rexx | 58 ++++ .../REXX/balanced_brackets.rexx | 40 +++ .../Racket/balanced_brackets.rkt | 17 ++ .../Ruby/balanced_brackets.rb | 24 ++ .../Scala/balanced_brackets.scala | 36 +++ .../Scheme/balanced_brackets.ss | 23 ++ .../Tcl/balanced_brackets-2.tcl | 8 + .../Tcl/balanced_brackets.tcl | 28 ++ Task/Balanced_ternary/0DESCRIPTION | 16 ++ .../Erlang/balanced_ternary-2.erl | 6 + .../Erlang/balanced_ternary.erl | 89 +++++++ Task/Balanced_ternary/Go/balanced_ternary.go | 224 ++++++++++++++++ .../Haskell/balanced_ternary.hs | 62 +++++ .../Prolog/balanced_ternary-2.pro | 123 +++++++++ .../Prolog/balanced_ternary-3.pro | 170 ++++++++++++ .../Prolog/balanced_ternary.pro | 67 +++++ .../Python/balanced_ternary.py | 95 +++++++ .../REXX/balanced_ternary.rexx | 55 ++++ .../Balanced_ternary/Ruby/balanced_ternary.rb | 128 +++++++++ .../Tcl/balanced_ternary-2.tcl | 10 + .../Balanced_ternary/Tcl/balanced_ternary.tcl | 57 ++++ Task/Best_shuffle/0DESCRIPTION | 11 + Task/Best_shuffle/AWK/best_shuffle-2.awk | 79 ++++++ Task/Best_shuffle/AWK/best_shuffle-3.awk | 7 + Task/Best_shuffle/AWK/best_shuffle.awk | 40 +++ Task/Best_shuffle/C/best_shuffle-2.c | 106 ++++++++ Task/Best_shuffle/C/best_shuffle-3.c | 5 + Task/Best_shuffle/C/best_shuffle-4.c | 36 +++ Task/Best_shuffle/C/best_shuffle.c | 111 ++++++++ Task/Best_shuffle/Clojure/best_shuffle.clj | 54 ++++ Task/Best_shuffle/Go/best_shuffle.go | 37 +++ Task/Best_shuffle/Haskell/best_shuffle-2.hs | 2 + Task/Best_shuffle/Haskell/best_shuffle.hs | 33 +++ Task/Best_shuffle/Java/best_shuffle.java | 36 +++ .../Best_shuffle/JavaScript/best_shuffle-2.js | 7 + .../Best_shuffle/JavaScript/best_shuffle-3.js | 6 + Task/Best_shuffle/JavaScript/best_shuffle.js | 47 ++++ Task/Best_shuffle/PHP/best_shuffle.php | 25 ++ Task/Best_shuffle/Perl/best_shuffle.pl | 38 +++ Task/Best_shuffle/PicoLisp/best_shuffle.l | 14 + Task/Best_shuffle/Prolog/best_shuffle.pro | 74 ++++++ Task/Best_shuffle/Python/best_shuffle-2.py | 50 ++++ Task/Best_shuffle/Python/best_shuffle.py | 28 ++ Task/Best_shuffle/REXX/best_shuffle-2.rexx | 37 +++ Task/Best_shuffle/REXX/best_shuffle-3.rexx | 25 ++ Task/Best_shuffle/REXX/best_shuffle.rexx | 42 +++ Task/Best_shuffle/Racket/best_shuffle.rkt | 20 ++ Task/Best_shuffle/Scheme/best_shuffle.ss | 65 +++++ Task/Best_shuffle/Tcl/best_shuffle-2.tcl | 3 + Task/Best_shuffle/Tcl/best_shuffle.tcl | 21 ++ Task/Binary_digits/0DESCRIPTION | 7 + Task/Binary_digits/1META.yaml | 4 + Task/Binary_digits/AWK/binary_digits.awk | 23 ++ Task/Binary_digits/C/binary_digits-2.c | 30 +++ Task/Binary_digits/C/binary_digits.c | 20 ++ Task/Binary_digits/Clojure/binary_digits.clj | 3 + .../CoffeeScript/binary_digits.coffee | 4 + Task/Binary_digits/Erlang/binary_digits.erl | 1 + Task/Binary_digits/Forth/binary_digits.fth | 4 + Task/Binary_digits/Go/binary_digits.go | 11 + Task/Binary_digits/Haskell/binary_digits.hs | 16 ++ Task/Binary_digits/Java/binary_digits.java | 7 + .../Binary_digits/JavaScript/binary_digits.js | 7 + Task/Binary_digits/PHP/binary_digits.php | 4 + Task/Binary_digits/Perl/binary_digits.pl | 3 + Task/Binary_digits/PicoLisp/binary_digits.l | 8 + Task/Binary_digits/Python/binary_digits-2.py | 18 ++ Task/Binary_digits/Python/binary_digits-3.py | 20 ++ Task/Binary_digits/Python/binary_digits.py | 18 ++ Task/Binary_digits/Racket/binary_digits.rkt | 3 + Task/Binary_search/0DESCRIPTION | 140 ++++++++++ Task/Binary_search/1META.yaml | 4 + Task/Binary_search/AWK/binary_search-2.awk | 9 + Task/Binary_search/AWK/binary_search.awk | 8 + Task/Binary_search/BASIC/binary_search-2.bas | 17 ++ Task/Binary_search/BASIC/binary_search-3.bas | 23 ++ Task/Binary_search/BASIC/binary_search.bas | 17 ++ Task/Binary_search/C/binary_search-2.c | 38 +++ Task/Binary_search/C/binary_search-3.c | 21 ++ Task/Binary_search/C/binary_search.c | 36 +++ Task/Binary_search/Clojure/binary_search.clj | 16 ++ .../CoffeeScript/binary_search.coffee | 16 ++ Task/Binary_search/Erlang/binary_search.erl | 27 ++ Task/Binary_search/Forth/binary_search.fth | 31 +++ Task/Binary_search/Fortran/binary_search-2.f | 23 ++ Task/Binary_search/Fortran/binary_search.f | 18 ++ Task/Binary_search/Go/binary_search-2.go | 15 ++ Task/Binary_search/Go/binary_search-3.go | 5 + Task/Binary_search/Go/binary_search.go | 12 + Task/Binary_search/Haskell/binary_search-2.hs | 5 + Task/Binary_search/Haskell/binary_search.hs | 9 + Task/Binary_search/Java/binary_search-2.java | 21 ++ Task/Binary_search/Java/binary_search-3.java | 8 + Task/Binary_search/Java/binary_search-4.java | 4 + Task/Binary_search/Java/binary_search.java | 27 ++ .../JavaScript/binary_search-2.js | 14 + .../Binary_search/JavaScript/binary_search.js | 11 + Task/Binary_search/Lua/binary_search-2.lua | 9 + Task/Binary_search/Lua/binary_search.lua | 14 + Task/Binary_search/PHP/binary_search-2.php | 15 ++ Task/Binary_search/PHP/binary_search.php | 19 ++ Task/Binary_search/Perl/binary_search-2.pl | 15 ++ Task/Binary_search/Perl/binary_search.pl | 15 ++ Task/Binary_search/PicoLisp/binary_search-2.l | 11 + Task/Binary_search/PicoLisp/binary_search.l | 8 + Task/Binary_search/Python/binary_search-2.py | 10 + Task/Binary_search/Python/binary_search-3.py | 8 + Task/Binary_search/Python/binary_search.py | 9 + Task/Binary_search/R/binary_search-2.r | 15 ++ Task/Binary_search/R/binary_search-3.r | 4 + Task/Binary_search/R/binary_search.r | 13 + Task/Binary_search/REXX/binary_search-2.rexx | 31 +++ Task/Binary_search/REXX/binary_search.rexx | 34 +++ Task/Binary_search/Racket/binary_search.rkt | 13 + Task/Binary_search/Ruby/binary_search-2.rb | 18 ++ Task/Binary_search/Ruby/binary_search.rb | 24 ++ Task/Binary_search/Scala/binary_search.scala | 9 + Task/Binary_search/Scheme/binary_search.ss | 11 + Task/Binary_search/Tcl/binary_search-2.tcl | 8 + Task/Binary_search/Tcl/binary_search.tcl | 25 ++ Task/Binary_strings/0DESCRIPTION | 14 + Task/Binary_strings/1META.yaml | 2 + Task/Binary_strings/BASIC/binary_strings.bas | 13 + Task/Binary_strings/C/binary_strings.c | 138 ++++++++++ .../Binary_strings/Forth/binary_strings-2.fth | 6 + Task/Binary_strings/Forth/binary_strings.fth | 8 + Task/Binary_strings/Go/binary_strings.go | 85 ++++++ .../Haskell/binary_strings-2.hs | 8 + .../Haskell/binary_strings-3.hs | 8 + .../Haskell/binary_strings-4.hs | 8 + .../Haskell/binary_strings-5.hs | 4 + .../Haskell/binary_strings-6.hs | 4 + .../Haskell/binary_strings-7.hs | 5 + Task/Binary_strings/Haskell/binary_strings.hs | 9 + Task/Binary_strings/Lua/binary_strings.lua | 31 +++ .../PicoLisp/binary_strings-2.l | 6 + .../PicoLisp/binary_strings-3.l | 5 + .../PicoLisp/binary_strings-4.l | 2 + Task/Binary_strings/PicoLisp/binary_strings.l | 2 + .../Python/binary_strings-10.py | 5 + .../Python/binary_strings-11.py | 5 + .../Python/binary_strings-12.py | 5 + .../Python/binary_strings-13.py | 2 + .../Python/binary_strings-14.py | 3 + .../Binary_strings/Python/binary_strings-2.py | 3 + .../Binary_strings/Python/binary_strings-3.py | 4 + .../Binary_strings/Python/binary_strings-4.py | 2 + .../Binary_strings/Python/binary_strings-5.py | 3 + .../Binary_strings/Python/binary_strings-6.py | 6 + .../Binary_strings/Python/binary_strings-7.py | 3 + .../Binary_strings/Python/binary_strings-8.py | 3 + .../Binary_strings/Python/binary_strings-9.py | 3 + Task/Binary_strings/Python/binary_strings.py | 5 + Task/Binary_strings/REXX/binary_strings.rexx | 31 +++ Task/Binary_strings/Racket/binary_strings.rkt | 47 ++++ Task/Binary_strings/Ruby/binary_strings.rb | 45 ++++ Task/Binary_strings/Tcl/binary_strings.tcl | 36 +++ Task/Caesar_cipher/0DESCRIPTION | 3 + Task/Caesar_cipher/1META.yaml | 2 + Task/Caesar_cipher/AWK/caesar_cipher.awk | 42 +++ Task/Caesar_cipher/C/caesar_cipher.c | 36 +++ Task/Caesar_cipher/Clojure/caesar_cipher.clj | 23 ++ .../CoffeeScript/caesar_cipher.coffee | 10 + Task/Caesar_cipher/Erlang/caesar_cipher-2.erl | 1 + Task/Caesar_cipher/Erlang/caesar_cipher.erl | 33 +++ Task/Caesar_cipher/Forth/caesar_cipher.fth | 19 ++ Task/Caesar_cipher/Fortran/caesar_cipher.f | 43 +++ Task/Caesar_cipher/Go/caesar_cipher-2.go | 57 ++++ Task/Caesar_cipher/Go/caesar_cipher.go | 59 +++++ Task/Caesar_cipher/Haskell/caesar_cipher.hs | 17 ++ Task/Caesar_cipher/Java/caesar_cipher.java | 26 ++ .../Caesar_cipher/JavaScript/caesar_cipher.js | 24 ++ Task/Caesar_cipher/Lua/caesar_cipher.lua | 30 +++ Task/Caesar_cipher/PHP/caesar_cipher.php | 19 ++ Task/Caesar_cipher/Perl/caesar_cipher.pl | 11 + Task/Caesar_cipher/PicoLisp/caesar_cipher.l | 6 + Task/Caesar_cipher/Prolog/caesar_cipher.pro | 33 +++ Task/Caesar_cipher/Python/caesar_cipher-2.py | 15 ++ Task/Caesar_cipher/Python/caesar_cipher-3.py | 9 + Task/Caesar_cipher/Python/caesar_cipher.py | 11 + Task/Caesar_cipher/REXX/caesar_cipher-2.rexx | 23 ++ Task/Caesar_cipher/REXX/caesar_cipher.rexx | 22 ++ Task/Caesar_cipher/Racket/caesar_cipher-2.rkt | 5 + Task/Caesar_cipher/Racket/caesar_cipher.rkt | 19 ++ Task/Caesar_cipher/Ruby/caesar_cipher.rb | 23 ++ .../Caesar_cipher/Scala/caesar_cipher-2.scala | 5 + Task/Caesar_cipher/Scala/caesar_cipher.scala | 12 + .../Smalltalk/caesar_cipher-2.st | 18 ++ Task/Caesar_cipher/Smalltalk/caesar_cipher.st | 1 + Task/Caesar_cipher/Tcl/caesar_cipher-2.tcl | 7 + Task/Caesar_cipher/Tcl/caesar_cipher.tcl | 23 ++ Task/Calendar/0DESCRIPTION | 15 ++ Task/Calendar/1META.yaml | 2 + Task/Calendar/C/calendar.c | 125 +++++++++ Task/Calendar/Perl/calendar.pl | 1 + Task/Calendar/PicoLisp/calendar.l | 13 + Task/Calendar/Python/calendar.py | 47 ++++ Task/Calendar/REXX/calendar.rexx | 145 ++++++++++ Task/Calendar/Ruby/calendar.rb | 70 +++++ Task/Calendar/Scala/calendar.scala | 203 ++++++++++++++ Task/Calendar/Tcl/calendar-2.tcl | 2 + Task/Calendar/Tcl/calendar-3.tcl | 2 + Task/Calendar/Tcl/calendar.tcl | 75 ++++++ Task/Check_that_file_exists/0DESCRIPTION | 1 + Task/Check_that_file_exists/1META.yaml | 2 + .../BASIC/check_that_file_exists-2.bas | 14 + .../BASIC/check_that_file_exists-3.bas | 21 ++ .../BASIC/check_that_file_exists.bas | 28 ++ .../C/check_that_file_exists.c | 28 ++ .../Clojure/check_that_file_exists.clj | 17 ++ .../Erlang/check_that_file_exists.erl | 23 ++ .../Forth/check_that_file_exists.fth | 5 + .../Fortran/check_that_file_exists-2.f | 9 + .../Fortran/check_that_file_exists.f | 4 + .../Go/check_that_file_exists.go | 24 ++ .../Haskell/check_that_file_exists.hs | 13 + .../Java/check_that_file_exists-2.java | 20 ++ .../Java/check_that_file_exists.java | 18 ++ .../JavaScript/check_that_file_exists.js | 6 + .../Lua/check_that_file_exists-2.lua | 9 + .../Lua/check_that_file_exists.lua | 12 + .../PHP/check_that_file_exists.php | 4 + .../Perl/check_that_file_exists.pl | 7 + .../PicoLisp/check_that_file_exists.l | 3 + .../Python/check_that_file_exists.py | 6 + .../R/check_that_file_exists.r | 7 + .../Ruby/check_that_file_exists-2.rb | 4 + .../Ruby/check_that_file_exists.rb | 4 + .../Scheme/check_that_file_exists.ss | 1 + .../Smalltalk/check_that_file_exists-2.st | 4 + .../Smalltalk/check_that_file_exists.st | 2 + .../Tcl/check_that_file_exists.tcl | 15 ++ Task/Checkpoint_synchronization/0DESCRIPTION | 11 + Task/Checkpoint_synchronization/1META.yaml | 6 + .../C/checkpoint_synchronization.c | 31 +++ .../Go/checkpoint_synchronization.go | 68 +++++ .../Haskell/checkpoint_synchronization-2.hs | 112 ++++++++ .../Haskell/checkpoint_synchronization.hs | 82 ++++++ .../Java/checkpoint_synchronization-2.java | 48 ++++ .../Java/checkpoint_synchronization.java | 89 +++++++ .../Perl/checkpoint_synchronization.pl | 69 +++++ .../PicoLisp/checkpoint_synchronization.l | 19 ++ .../Ruby/checkpoint_synchronization.rb | 158 +++++++++++ .../Tcl/checkpoint_synchronization-2.tcl | 30 +++ .../Tcl/checkpoint_synchronization.tcl | 97 +++++++ Task/Classes/0DESCRIPTION | 14 + Task/Classes/1META.yaml | 6 + Task/Classes/ActionScript/classes.as | 21 ++ Task/Classes/BASIC/classes.bas | 19 ++ Task/Classes/C/classes.c | 30 +++ Task/Classes/CoffeeScript/classes.coffee | 14 + Task/Classes/Forth/classes-2.fth | 1 + Task/Classes/Forth/classes-3.fth | 1 + Task/Classes/Forth/classes-4.fth | 2 + Task/Classes/Forth/classes-5.fth | 2 + Task/Classes/Forth/classes-6.fth | 5 + Task/Classes/Forth/classes.fth | 14 + Task/Classes/Go/classes-2.go | 26 ++ Task/Classes/Go/classes.go | 50 ++++ Task/Classes/Haskell/classes-2.hs | 23 ++ Task/Classes/Haskell/classes-3.hs | 21 ++ Task/Classes/Haskell/classes.hs | 33 +++ Task/Classes/Java/classes.java | 19 ++ Task/Classes/JavaScript/classes.js | 24 ++ Task/Classes/Lua/classes.lua | 14 + Task/Classes/PHP/classes.php | 12 + Task/Classes/Perl/classes-2.pl | 12 + Task/Classes/Perl/classes-3.pl | 7 + Task/Classes/Perl/classes-4.pl | 4 + Task/Classes/Perl/classes.pl | 19 ++ Task/Classes/PicoLisp/classes.l | 8 + Task/Classes/Python/classes-2.py | 2 + Task/Classes/Python/classes.py | 38 +++ Task/Classes/R/classes-2.r | 24 ++ Task/Classes/R/classes.r | 13 + Task/Classes/Racket/classes.rkt | 15 ++ Task/Classes/Ruby/classes.rb | 26 ++ Task/Classes/Sather/classes-2.sa | 12 + Task/Classes/Sather/classes.sa | 21 ++ Task/Classes/Scala/classes.scala | 19 ++ Task/Classes/Scheme/classes.ss | 14 + Task/Classes/Smalltalk/classes.st | 15 ++ Task/Classes/Tcl/classes.tcl | 22 ++ Task/Closest-pair_problem/0DESCRIPTION | 63 +++++ Task/Closest-pair_problem/1META.yaml | 2 + .../Clojure/closest_pair_problem.clj | 36 +++ .../Go/closest_pair_problem-2.go | 117 +++++++++ .../Go/closest_pair_problem.go | 46 ++++ .../Haskell/closest_pair_problem-2.hs | 3 + .../Haskell/closest_pair_problem.hs | 16 ++ .../Java/closest_pair_problem.java | 186 +++++++++++++ .../JavaScript/closest_pair_problem.js | 27 ++ .../Perl/closest_pair_problem.pl | 107 ++++++++ .../PicoLisp/closest_pair_problem.l | 14 + .../Python/closest_pair_problem.py | 87 ++++++ .../R/closest_pair_problem-2.r | 20 ++ .../R/closest_pair_problem-3.r | 18 ++ .../R/closest_pair_problem-4.r | 36 +++ .../R/closest_pair_problem-5.r | 88 +++++++ .../R/closest_pair_problem.r | 30 +++ .../REXX/closest_pair_problem.rexx | 37 +++ .../Ruby/closest_pair_problem.rb | 68 +++++ .../Scala/closest_pair_problem.scala | 24 ++ .../Tcl/closest_pair_problem.tcl | 90 +++++++ Task/Collections/0DESCRIPTION | 3 + Task/Collections/1META.yaml | 2 + Task/Collections/AWK/collections-2.awk | 1 + Task/Collections/AWK/collections-3.awk | 1 + Task/Collections/AWK/collections-4.awk | 1 + Task/Collections/AWK/collections.awk | 1 + Task/Collections/C/collections-2.c | 12 + Task/Collections/C/collections.c | 11 + Task/Collections/Clojure/collections-2.clj | 3 + Task/Collections/Clojure/collections-3.clj | 3 + Task/Collections/Clojure/collections-4.clj | 3 + Task/Collections/Clojure/collections.clj | 4 + Task/Collections/Forth/collections-2.fth | 7 + Task/Collections/Forth/collections-3.fth | 7 + Task/Collections/Forth/collections.fth | 7 + Task/Collections/Go/collections.go | 10 + Task/Collections/Haskell/collections-2.hs | 1 + Task/Collections/Haskell/collections-3.hs | 1 + Task/Collections/Haskell/collections-4.hs | 1 + Task/Collections/Haskell/collections.hs | 1 + Task/Collections/Java/collections-2.java | 4 + Task/Collections/Java/collections-3.java | 3 + Task/Collections/Java/collections-4.java | 5 + Task/Collections/Java/collections.java | 14 + Task/Collections/JavaScript/collections-2.js | 5 + Task/Collections/JavaScript/collections.js | 5 + Task/Collections/Lua/collections.lua | 8 + Task/Collections/PHP/collections.php | 10 + Task/Collections/Perl/collections.pl | 18 ++ Task/Collections/PicoLisp/collections.l | 14 + Task/Collections/Python/collections.py | 20 ++ Task/Collections/R/collections-2.r | 2 + Task/Collections/R/collections-3.r | 2 + Task/Collections/R/collections-4.r | 2 + Task/Collections/R/collections-5.r | 3 + Task/Collections/R/collections-6.r | 1 + Task/Collections/R/collections-7.r | 13 + Task/Collections/R/collections-8.r | 1 + Task/Collections/R/collections.r | 3 + Task/Collections/REXX/collections-2.rexx | 1 + Task/Collections/REXX/collections-3.rexx | 5 + Task/Collections/REXX/collections-4.rexx | 10 + Task/Collections/REXX/collections-5.rexx | 31 +++ Task/Collections/REXX/collections.rexx | 36 +++ Task/Collections/Ruby/collections-2.rb | 9 + Task/Collections/Ruby/collections.rb | 8 + Task/Collections/Scala/collections.scala | 37 +++ Task/Collections/Scheme/collections-2.ss | 4 + Task/Collections/Scheme/collections-3.ss | 2 + Task/Collections/Scheme/collections-4.ss | 1 + Task/Collections/Scheme/collections-5.ss | 2 + Task/Collections/Scheme/collections-6.ss | 1 + Task/Collections/Scheme/collections-7.ss | 1 + Task/Collections/Scheme/collections-8.ss | 2 + Task/Collections/Scheme/collections-9.ss | 1 + Task/Collections/Scheme/collections.ss | 1 + Task/Collections/Smalltalk/collections.st | 32 +++ Task/Collections/Tcl/collections-2.tcl | 24 ++ Task/Collections/Tcl/collections-3.tcl | 9 + Task/Collections/Tcl/collections.tcl | 12 + Task/Color_of_a_screen_pixel/0DESCRIPTION | 1 + Task/Color_of_a_screen_pixel/1META.yaml | 4 + .../BASIC/color_of_a_screen_pixel.bas | 1 + .../C/color_of_a_screen_pixel-2.c | 26 ++ .../C/color_of_a_screen_pixel.c | 15 ++ .../Clojure/color_of_a_screen_pixel.clj | 2 + .../Java/color_of_a_screen_pixel.java | 3 + .../PHP/color_of_a_screen_pixel.php | 3 + .../PicoLisp/color_of_a_screen_pixel.l | 2 + .../Python/color_of_a_screen_pixel-2.py | 5 + .../Python/color_of_a_screen_pixel-3.py | 11 + .../Python/color_of_a_screen_pixel-4.py | 7 + .../Python/color_of_a_screen_pixel-5.py | 9 + .../Python/color_of_a_screen_pixel.py | 9 + .../Tcl/color_of_a_screen_pixel.tcl | 22 ++ Task/Deepcopy/0DESCRIPTION | 13 + Task/Deepcopy/Go/deepcopy-2.go | 62 +++++ Task/Deepcopy/Go/deepcopy.go | 37 +++ Task/Deepcopy/JavaScript/deepcopy-2.js | 8 + Task/Deepcopy/JavaScript/deepcopy.js | 8 + .../Define_a_primitive_data_type/0DESCRIPTION | 3 + Task/Define_a_primitive_data_type/1META.yaml | 2 + .../Fortran/define_a_primitive_data_type-2.f | 25 ++ .../Fortran/define_a_primitive_data_type.f | 102 +++++++ .../Haskell/define_a_primitive_data_type-2.hs | 5 + .../Haskell/define_a_primitive_data_type-3.hs | 5 + .../Haskell/define_a_primitive_data_type.hs | 44 ++++ .../Java/define_a_primitive_data_type.java | 71 +++++ .../define_a_primitive_data_type.js | 22 ++ .../Perl/define_a_primitive_data_type.pl | 20 ++ .../PicoLisp/define_a_primitive_data_type.l | 32 +++ .../Python/define_a_primitive_data_type.py | 22 ++ .../Racket/define_a_primitive_data_type-2.rkt | 11 + .../Racket/define_a_primitive_data_type.rkt | 7 + .../Ruby/define_a_primitive_data_type.rb | 86 ++++++ .../Tcl/define_a_primitive_data_type.tcl | 37 +++ Task/Delegates/0DESCRIPTION | 12 + Task/Delegates/1META.yaml | 2 + Task/Delegates/C/delegates.c | 86 ++++++ .../Delegates/CoffeeScript/delegates-2.coffee | 4 + Task/Delegates/CoffeeScript/delegates.coffee | 24 ++ Task/Delegates/Go/delegates.go | 39 +++ Task/Delegates/Java/delegates.java | 43 +++ Task/Delegates/JavaScript/delegates.js | 25 ++ Task/Delegates/PHP/delegates.php | 25 ++ Task/Delegates/Perl/delegates-2.pl | 54 ++++ Task/Delegates/Perl/delegates.pl | 38 +++ Task/Delegates/PicoLisp/delegates.l | 30 +++ Task/Delegates/Python/delegates.py | 25 ++ Task/Delegates/Ruby/delegates-2.rb | 19 ++ Task/Delegates/Ruby/delegates.rb | 31 +++ Task/Delegates/Tcl/delegates-2.tcl | 10 + Task/Delegates/Tcl/delegates.tcl | 53 ++++ Task/Delete_a_file/0DESCRIPTION | 1 + Task/Delete_a_file/1META.yaml | 2 + Task/Delete_a_file/AWK/delete_a_file.awk | 4 + Task/Delete_a_file/BASIC/delete_a_file-2.bas | 1 + Task/Delete_a_file/BASIC/delete_a_file.bas | 4 + Task/Delete_a_file/C/delete_a_file-2.c | 9 + Task/Delete_a_file/C/delete_a_file.c | 9 + Task/Delete_a_file/Clojure/delete_a_file.clj | 6 + Task/Delete_a_file/Erlang/delete_a_file.erl | 1 + Task/Delete_a_file/Forth/delete_a_file.fth | 2 + Task/Delete_a_file/Fortran/delete_a_file.f | 4 + Task/Delete_a_file/Go/delete_a_file.go | 12 + Task/Delete_a_file/Haskell/delete_a_file.hs | 8 + Task/Delete_a_file/Java/delete_a_file.java | 18 ++ .../JavaScript/delete_a_file-2.js | 10 + .../Delete_a_file/JavaScript/delete_a_file.js | 7 + Task/Delete_a_file/Lua/delete_a_file.lua | 4 + Task/Delete_a_file/PHP/delete_a_file.php | 6 + Task/Delete_a_file/Perl/delete_a_file.pl | 7 + Task/Delete_a_file/PicoLisp/delete_a_file.l | 4 + Task/Delete_a_file/Python/delete_a_file-2.py | 2 + Task/Delete_a_file/Python/delete_a_file.py | 7 + Task/Delete_a_file/R/delete_a_file.r | 12 + Task/Delete_a_file/Ruby/delete_a_file.rb | 3 + Task/Delete_a_file/Scheme/delete_a_file.ss | 1 + Task/Delete_a_file/Smalltalk/delete_a_file.st | 4 + Task/Delete_a_file/Tcl/delete_a_file.tcl | 7 + Task/Detect_division_by_zero/0DESCRIPTION | 1 + .../C/detect_division_by_zero.c | 100 +++++++ .../Clojure/detect_division_by_zero.clj | 7 + .../Eiffel/detect_division_by_zero.e | 21 ++ .../Erlang/detect_division_by_zero.erl | 5 + .../Forth/detect_division_by_zero.fth | 2 + .../Go/detect_division_by_zero.go | 16 ++ .../Haskell/detect_division_by_zero.hs | 3 + .../Java/detect_division_by_zero-2.java | 6 + .../Java/detect_division_by_zero.java | 3 + .../JavaScript/detect_division_by_zero.js | 7 + .../Lua/detect_division_by_zero.lua | 5 + .../PHP/detect_division_by_zero-2.php | 3 + .../PHP/detect_division_by_zero.php | 6 + .../Perl/detect_division_by_zero.pl | 4 + .../PicoLisp/detect_division_by_zero.l | 1 + .../Python/detect_division_by_zero.py | 7 + .../R/detect_division_by_zero.r | 4 + .../REXX/detect_division_by_zero.rexx | 22 ++ .../Racket/detect_division_by_zero.rkt | 5 + .../Ruby/detect_division_by_zero-2.rb | 4 + .../Ruby/detect_division_by_zero-3.rb | 9 + .../Ruby/detect_division_by_zero-4.rb | 4 + .../Ruby/detect_division_by_zero.rb | 9 + .../Scala/detect_division_by_zero.scala | 17 ++ .../Smalltalk/detect_division_by_zero.st | 7 + .../Tcl/detect_division_by_zero-2.tcl | 15 ++ .../Tcl/detect_division_by_zero.tcl | 15 ++ .../0DESCRIPTION | 1 + .../1META.yaml | 2 + .../AWK/determine_if_a_string_is_numeric.awk | 2 + .../determine_if_a_string_is_numeric.as | 4 + .../determine_if_a_string_is_numeric.bas | 6 + .../C/determine_if_a_string_is_numeric.c | 10 + .../determine_if_a_string_is_numeric-2.clj | 1 + .../determine_if_a_string_is_numeric.clj | 7 + .../determine_if_a_string_is_numeric.coffee | 2 + .../determine_if_a_string_is_numeric.erl | 4 + .../determine_if_a_string_is_numeric.fth | 22 ++ .../determine_if_a_string_is_numeric.f | 9 + .../Go/determine_if_a_string_is_numeric.go | 6 + .../determine_if_a_string_is_numeric-2.hs | 4 + .../determine_if_a_string_is_numeric.hs | 10 + .../determine_if_a_string_is_numeric-2.java | 10 + .../determine_if_a_string_is_numeric-3.java | 3 + .../determine_if_a_string_is_numeric-4.java | 6 + .../determine_if_a_string_is_numeric-5.java | 4 + .../determine_if_a_string_is_numeric.java | 10 + .../determine_if_a_string_is_numeric.js | 6 + .../Lua/determine_if_a_string_is_numeric.lua | 3 + .../PHP/determine_if_a_string_is_numeric.php | 5 + .../determine_if_a_string_is_numeric-2.pl | 8 + .../determine_if_a_string_is_numeric-3.pl | 15 ++ .../Perl/determine_if_a_string_is_numeric.pl | 2 + .../determine_if_a_string_is_numeric.l | 8 + .../determine_if_a_string_is_numeric-2.py | 3 + .../determine_if_a_string_is_numeric-3.py | 28 ++ .../determine_if_a_string_is_numeric-4.py | 16 ++ .../determine_if_a_string_is_numeric.py | 5 + .../R/determine_if_a_string_is_numeric.r | 3 + .../determine_if_a_string_is_numeric.rexx | 46 ++++ .../determine_if_a_string_is_numeric.rkt | 1 + .../determine_if_a_string_is_numeric-2.rb | 3 + .../Ruby/determine_if_a_string_is_numeric.rb | 9 + .../determine_if_a_string_is_numeric.scala | 1 + .../determine_if_a_string_is_numeric.ss | 1 + .../determine_if_a_string_is_numeric-2.st | 1 + .../determine_if_a_string_is_numeric-3.st | 1 + .../determine_if_a_string_is_numeric.st | 20 ++ .../Tcl/determine_if_a_string_is_numeric.tcl | 3 + Task/Forest_fire/0DESCRIPTION | 17 ++ Task/Forest_fire/1META.yaml | 2 + Task/Forest_fire/C/forest_fire-2.c | 65 +++++ Task/Forest_fire/C/forest_fire.c | 248 ++++++++++++++++++ Task/Forest_fire/Clojure/forest_fire.clj | 77 ++++++ Task/Forest_fire/Fortran/forest_fire-2.f | 18 ++ Task/Forest_fire/Fortran/forest_fire.f | 183 +++++++++++++ Task/Forest_fire/Go/forest_fire.go | 84 ++++++ Task/Forest_fire/Haskell/forest_fire-2.hs | 25 ++ Task/Forest_fire/Haskell/forest_fire.hs | 47 ++++ Task/Forest_fire/Java/forest_fire.java | 137 ++++++++++ Task/Forest_fire/JavaScript/forest_fire-2.js | 14 + Task/Forest_fire/JavaScript/forest_fire.js | 63 +++++ Task/Forest_fire/Perl/forest_fire.pl | 63 +++++ Task/Forest_fire/PicoLisp/forest_fire.l | 43 +++ Task/Forest_fire/Python/forest_fire.py | 83 ++++++ Task/Forest_fire/REXX/forest_fire.rexx | 67 +++++ Task/Forest_fire/Racket/forest_fire.rkt | 60 +++++ Task/Forest_fire/Ruby/forest_fire.rb | 60 +++++ Task/Forest_fire/Sather/forest_fire.sa | 196 ++++++++++++++ Task/Forest_fire/Scala/forest_fire-2.scala | 9 + Task/Forest_fire/Scala/forest_fire.scala | 28 ++ Task/Forest_fire/Tcl/forest_fire.tcl | 78 ++++++ 1194 files changed, 15353 insertions(+), 1 deletion(-) create mode 120000 Lang/AWK/Ackermann_function create mode 120000 Lang/AWK/Arrays create mode 120000 Lang/AWK/Balanced_brackets create mode 120000 Lang/AWK/Best_shuffle create mode 120000 Lang/AWK/Binary_digits create mode 120000 Lang/AWK/Binary_search create mode 120000 Lang/AWK/Caesar_cipher create mode 120000 Lang/AWK/Collections create mode 120000 Lang/AWK/Delete_a_file create mode 120000 Lang/AWK/Determine_if_a_string_is_numeric create mode 120000 Lang/ActionScript/Ackermann_function create mode 120000 Lang/ActionScript/Arrays create mode 120000 Lang/ActionScript/Classes create mode 120000 Lang/ActionScript/Determine_if_a_string_is_numeric create mode 120000 Lang/BASIC/Ackermann_function create mode 120000 Lang/BASIC/Arrays create mode 120000 Lang/BASIC/Balanced_brackets create mode 120000 Lang/BASIC/Binary_search create mode 120000 Lang/BASIC/Binary_strings create mode 120000 Lang/BASIC/Check_that_file_exists create mode 120000 Lang/BASIC/Classes create mode 120000 Lang/BASIC/Color_of_a_screen_pixel create mode 120000 Lang/BASIC/Delete_a_file create mode 120000 Lang/BASIC/Determine_if_a_string_is_numeric create mode 120000 Lang/Babel/Ackermann_function create mode 120000 Lang/Befunge/Ackermann_function create mode 120000 Lang/Befunge/Balanced_brackets create mode 120000 Lang/C/Ackermann_function create mode 120000 Lang/C/Arrays create mode 120000 Lang/C/Assertions create mode 120000 Lang/C/Balanced_brackets create mode 120000 Lang/C/Best_shuffle create mode 120000 Lang/C/Binary_digits create mode 120000 Lang/C/Binary_search create mode 120000 Lang/C/Binary_strings create mode 120000 Lang/C/Caesar_cipher create mode 120000 Lang/C/Calendar create mode 120000 Lang/C/Check_that_file_exists create mode 120000 Lang/C/Checkpoint_synchronization create mode 120000 Lang/C/Classes create mode 120000 Lang/C/Collections create mode 120000 Lang/C/Color_of_a_screen_pixel create mode 120000 Lang/C/Delegates create mode 120000 Lang/C/Delete_a_file create mode 120000 Lang/C/Detect_division_by_zero create mode 120000 Lang/C/Determine_if_a_string_is_numeric create mode 120000 Lang/C/Forest_fire create mode 120000 Lang/Clojure/Ackermann_function create mode 120000 Lang/Clojure/Arrays create mode 120000 Lang/Clojure/Assertions create mode 120000 Lang/Clojure/Balanced_brackets create mode 120000 Lang/Clojure/Best_shuffle create mode 120000 Lang/Clojure/Binary_digits create mode 120000 Lang/Clojure/Binary_search create mode 120000 Lang/Clojure/Caesar_cipher create mode 120000 Lang/Clojure/Check_that_file_exists create mode 120000 Lang/Clojure/Closest-pair_problem create mode 120000 Lang/Clojure/Collections create mode 120000 Lang/Clojure/Color_of_a_screen_pixel create mode 120000 Lang/Clojure/Delete_a_file create mode 120000 Lang/Clojure/Detect_division_by_zero create mode 120000 Lang/Clojure/Determine_if_a_string_is_numeric create mode 120000 Lang/Clojure/Forest_fire create mode 120000 Lang/CoffeeScript/Ackermann_function create mode 120000 Lang/CoffeeScript/Arrays create mode 120000 Lang/CoffeeScript/Balanced_brackets create mode 120000 Lang/CoffeeScript/Binary_digits create mode 120000 Lang/CoffeeScript/Binary_search create mode 120000 Lang/CoffeeScript/Caesar_cipher create mode 120000 Lang/CoffeeScript/Classes create mode 120000 Lang/CoffeeScript/Delegates create mode 120000 Lang/CoffeeScript/Determine_if_a_string_is_numeric create mode 120000 Lang/Dylan/Ackermann_function create mode 120000 Lang/Eiffel/Ackermann_function create mode 120000 Lang/Eiffel/Arrays create mode 120000 Lang/Eiffel/Assertions create mode 120000 Lang/Eiffel/Detect_division_by_zero create mode 120000 Lang/Erlang/Ackermann_function create mode 120000 Lang/Erlang/Arrays create mode 120000 Lang/Erlang/Assertions create mode 120000 Lang/Erlang/Balanced_ternary create mode 120000 Lang/Erlang/Binary_digits create mode 120000 Lang/Erlang/Binary_search create mode 120000 Lang/Erlang/Caesar_cipher create mode 120000 Lang/Erlang/Check_that_file_exists create mode 120000 Lang/Erlang/Delete_a_file create mode 120000 Lang/Erlang/Detect_division_by_zero create mode 120000 Lang/Erlang/Determine_if_a_string_is_numeric create mode 120000 Lang/Forth/Ackermann_function create mode 120000 Lang/Forth/Arrays create mode 120000 Lang/Forth/Balanced_brackets create mode 120000 Lang/Forth/Binary_digits create mode 120000 Lang/Forth/Binary_search create mode 120000 Lang/Forth/Binary_strings create mode 120000 Lang/Forth/Caesar_cipher create mode 120000 Lang/Forth/Check_that_file_exists create mode 120000 Lang/Forth/Classes create mode 120000 Lang/Forth/Collections create mode 120000 Lang/Forth/Delete_a_file create mode 120000 Lang/Forth/Detect_division_by_zero create mode 120000 Lang/Forth/Determine_if_a_string_is_numeric create mode 120000 Lang/Fortran/Ackermann_function create mode 120000 Lang/Fortran/Arrays create mode 120000 Lang/Fortran/Binary_search create mode 120000 Lang/Fortran/Caesar_cipher create mode 120000 Lang/Fortran/Check_that_file_exists create mode 120000 Lang/Fortran/Define_a_primitive_data_type create mode 120000 Lang/Fortran/Delete_a_file create mode 120000 Lang/Fortran/Determine_if_a_string_is_numeric create mode 120000 Lang/Fortran/Forest_fire create mode 120000 Lang/Go/Ackermann_function create mode 120000 Lang/Go/Arrays create mode 120000 Lang/Go/Assertions create mode 120000 Lang/Go/Balanced_brackets create mode 120000 Lang/Go/Balanced_ternary create mode 120000 Lang/Go/Best_shuffle create mode 120000 Lang/Go/Binary_digits create mode 120000 Lang/Go/Binary_search create mode 120000 Lang/Go/Binary_strings create mode 120000 Lang/Go/Caesar_cipher create mode 120000 Lang/Go/Check_that_file_exists create mode 120000 Lang/Go/Checkpoint_synchronization create mode 120000 Lang/Go/Classes create mode 120000 Lang/Go/Closest-pair_problem create mode 120000 Lang/Go/Collections create mode 120000 Lang/Go/Deepcopy create mode 120000 Lang/Go/Delegates create mode 120000 Lang/Go/Delete_a_file create mode 120000 Lang/Go/Detect_division_by_zero create mode 120000 Lang/Go/Determine_if_a_string_is_numeric create mode 120000 Lang/Go/Forest_fire create mode 120000 Lang/Haskell/Ackermann_function create mode 120000 Lang/Haskell/Arrays create mode 120000 Lang/Haskell/Assertions create mode 120000 Lang/Haskell/Balanced_brackets create mode 120000 Lang/Haskell/Balanced_ternary create mode 120000 Lang/Haskell/Best_shuffle create mode 120000 Lang/Haskell/Binary_digits create mode 120000 Lang/Haskell/Binary_search create mode 120000 Lang/Haskell/Binary_strings create mode 120000 Lang/Haskell/Caesar_cipher create mode 120000 Lang/Haskell/Check_that_file_exists create mode 120000 Lang/Haskell/Checkpoint_synchronization create mode 120000 Lang/Haskell/Classes create mode 120000 Lang/Haskell/Closest-pair_problem create mode 120000 Lang/Haskell/Collections create mode 120000 Lang/Haskell/Define_a_primitive_data_type create mode 120000 Lang/Haskell/Delete_a_file create mode 120000 Lang/Haskell/Detect_division_by_zero create mode 120000 Lang/Haskell/Determine_if_a_string_is_numeric create mode 120000 Lang/Haskell/Forest_fire create mode 120000 Lang/Java/Ackermann_function create mode 120000 Lang/Java/Arrays create mode 120000 Lang/Java/Assertions create mode 120000 Lang/Java/Balanced_brackets create mode 120000 Lang/Java/Best_shuffle create mode 120000 Lang/Java/Binary_digits create mode 120000 Lang/Java/Binary_search create mode 120000 Lang/Java/Caesar_cipher create mode 120000 Lang/Java/Check_that_file_exists create mode 120000 Lang/Java/Checkpoint_synchronization create mode 120000 Lang/Java/Classes create mode 120000 Lang/Java/Closest-pair_problem create mode 120000 Lang/Java/Collections create mode 120000 Lang/Java/Color_of_a_screen_pixel create mode 120000 Lang/Java/Define_a_primitive_data_type create mode 120000 Lang/Java/Delegates create mode 120000 Lang/Java/Delete_a_file create mode 120000 Lang/Java/Detect_division_by_zero create mode 120000 Lang/Java/Determine_if_a_string_is_numeric create mode 120000 Lang/Java/Forest_fire create mode 120000 Lang/JavaScript/Ackermann_function create mode 120000 Lang/JavaScript/Arrays create mode 120000 Lang/JavaScript/Balanced_brackets create mode 120000 Lang/JavaScript/Best_shuffle create mode 120000 Lang/JavaScript/Binary_digits create mode 120000 Lang/JavaScript/Binary_search create mode 120000 Lang/JavaScript/Caesar_cipher create mode 120000 Lang/JavaScript/Check_that_file_exists create mode 120000 Lang/JavaScript/Classes create mode 120000 Lang/JavaScript/Closest-pair_problem create mode 120000 Lang/JavaScript/Collections create mode 120000 Lang/JavaScript/Deepcopy create mode 120000 Lang/JavaScript/Define_a_primitive_data_type create mode 120000 Lang/JavaScript/Delegates create mode 120000 Lang/JavaScript/Delete_a_file create mode 120000 Lang/JavaScript/Detect_division_by_zero create mode 120000 Lang/JavaScript/Determine_if_a_string_is_numeric create mode 120000 Lang/JavaScript/Forest_fire create mode 120000 Lang/Lua/Ackermann_function create mode 120000 Lang/Lua/Arrays create mode 120000 Lang/Lua/Assertions create mode 120000 Lang/Lua/Balanced_brackets create mode 120000 Lang/Lua/Binary_search create mode 120000 Lang/Lua/Binary_strings create mode 120000 Lang/Lua/Caesar_cipher create mode 120000 Lang/Lua/Check_that_file_exists create mode 120000 Lang/Lua/Classes create mode 120000 Lang/Lua/Collections create mode 120000 Lang/Lua/Delete_a_file create mode 120000 Lang/Lua/Detect_division_by_zero create mode 120000 Lang/Lua/Determine_if_a_string_is_numeric create mode 120000 Lang/PHP/Ackermann_function create mode 120000 Lang/PHP/Arrays create mode 120000 Lang/PHP/Assertions create mode 120000 Lang/PHP/Best_shuffle create mode 120000 Lang/PHP/Binary_digits create mode 120000 Lang/PHP/Binary_search create mode 120000 Lang/PHP/Caesar_cipher create mode 120000 Lang/PHP/Check_that_file_exists create mode 120000 Lang/PHP/Classes create mode 120000 Lang/PHP/Collections create mode 120000 Lang/PHP/Color_of_a_screen_pixel create mode 120000 Lang/PHP/Delegates create mode 120000 Lang/PHP/Delete_a_file create mode 120000 Lang/PHP/Detect_division_by_zero create mode 120000 Lang/PHP/Determine_if_a_string_is_numeric create mode 120000 Lang/Perl/Ackermann_function create mode 120000 Lang/Perl/Arrays create mode 120000 Lang/Perl/Assertions create mode 120000 Lang/Perl/Balanced_brackets create mode 120000 Lang/Perl/Best_shuffle create mode 120000 Lang/Perl/Binary_digits create mode 120000 Lang/Perl/Binary_search create mode 120000 Lang/Perl/Caesar_cipher create mode 120000 Lang/Perl/Calendar create mode 120000 Lang/Perl/Check_that_file_exists create mode 120000 Lang/Perl/Checkpoint_synchronization create mode 120000 Lang/Perl/Classes create mode 120000 Lang/Perl/Closest-pair_problem create mode 120000 Lang/Perl/Collections create mode 120000 Lang/Perl/Define_a_primitive_data_type create mode 120000 Lang/Perl/Delegates create mode 120000 Lang/Perl/Delete_a_file create mode 120000 Lang/Perl/Detect_division_by_zero create mode 120000 Lang/Perl/Determine_if_a_string_is_numeric create mode 120000 Lang/Perl/Forest_fire create mode 120000 Lang/PicoLisp/Ackermann_function create mode 120000 Lang/PicoLisp/Arrays create mode 120000 Lang/PicoLisp/Assertions create mode 120000 Lang/PicoLisp/Balanced_brackets create mode 120000 Lang/PicoLisp/Best_shuffle create mode 120000 Lang/PicoLisp/Binary_digits create mode 120000 Lang/PicoLisp/Binary_search create mode 120000 Lang/PicoLisp/Binary_strings create mode 120000 Lang/PicoLisp/Caesar_cipher create mode 120000 Lang/PicoLisp/Calendar create mode 120000 Lang/PicoLisp/Check_that_file_exists create mode 120000 Lang/PicoLisp/Checkpoint_synchronization create mode 120000 Lang/PicoLisp/Classes create mode 120000 Lang/PicoLisp/Closest-pair_problem create mode 120000 Lang/PicoLisp/Collections create mode 120000 Lang/PicoLisp/Color_of_a_screen_pixel create mode 120000 Lang/PicoLisp/Define_a_primitive_data_type create mode 120000 Lang/PicoLisp/Delegates create mode 120000 Lang/PicoLisp/Delete_a_file create mode 120000 Lang/PicoLisp/Detect_division_by_zero create mode 120000 Lang/PicoLisp/Determine_if_a_string_is_numeric create mode 120000 Lang/PicoLisp/Forest_fire create mode 120000 Lang/Prolog/Ackermann_function create mode 120000 Lang/Prolog/Arrays create mode 120000 Lang/Prolog/Assertions create mode 120000 Lang/Prolog/Balanced_brackets create mode 120000 Lang/Prolog/Balanced_ternary create mode 120000 Lang/Prolog/Best_shuffle create mode 120000 Lang/Prolog/Caesar_cipher create mode 120000 Lang/Python/Ackermann_function create mode 120000 Lang/Python/Arrays create mode 120000 Lang/Python/Assertions create mode 120000 Lang/Python/Balanced_brackets create mode 120000 Lang/Python/Balanced_ternary create mode 120000 Lang/Python/Best_shuffle create mode 120000 Lang/Python/Binary_digits create mode 120000 Lang/Python/Binary_search create mode 120000 Lang/Python/Binary_strings create mode 120000 Lang/Python/Caesar_cipher create mode 120000 Lang/Python/Calendar create mode 120000 Lang/Python/Check_that_file_exists create mode 120000 Lang/Python/Classes create mode 120000 Lang/Python/Closest-pair_problem create mode 120000 Lang/Python/Collections create mode 120000 Lang/Python/Color_of_a_screen_pixel create mode 120000 Lang/Python/Define_a_primitive_data_type create mode 120000 Lang/Python/Delegates create mode 120000 Lang/Python/Delete_a_file create mode 120000 Lang/Python/Detect_division_by_zero create mode 120000 Lang/Python/Determine_if_a_string_is_numeric create mode 120000 Lang/Python/Forest_fire create mode 120000 Lang/R/Ackermann_function create mode 120000 Lang/R/Arrays create mode 120000 Lang/R/Assertions create mode 120000 Lang/R/Balanced_brackets create mode 120000 Lang/R/Binary_search create mode 120000 Lang/R/Check_that_file_exists create mode 120000 Lang/R/Classes create mode 120000 Lang/R/Closest-pair_problem create mode 120000 Lang/R/Collections create mode 120000 Lang/R/Delete_a_file create mode 120000 Lang/R/Detect_division_by_zero create mode 120000 Lang/R/Determine_if_a_string_is_numeric create mode 120000 Lang/REXX/Ackermann_function create mode 120000 Lang/REXX/Arrays create mode 120000 Lang/REXX/Assertions create mode 120000 Lang/REXX/Balanced_brackets create mode 120000 Lang/REXX/Balanced_ternary create mode 120000 Lang/REXX/Best_shuffle create mode 120000 Lang/REXX/Binary_search create mode 120000 Lang/REXX/Binary_strings create mode 120000 Lang/REXX/Caesar_cipher create mode 120000 Lang/REXX/Calendar create mode 120000 Lang/REXX/Closest-pair_problem create mode 120000 Lang/REXX/Collections create mode 120000 Lang/REXX/Detect_division_by_zero create mode 120000 Lang/REXX/Determine_if_a_string_is_numeric create mode 120000 Lang/REXX/Forest_fire create mode 120000 Lang/Racket/Ackermann_function create mode 120000 Lang/Racket/Arrays create mode 120000 Lang/Racket/Assertions create mode 120000 Lang/Racket/Balanced_brackets create mode 120000 Lang/Racket/Best_shuffle create mode 120000 Lang/Racket/Binary_digits create mode 120000 Lang/Racket/Binary_search create mode 120000 Lang/Racket/Binary_strings create mode 120000 Lang/Racket/Caesar_cipher create mode 120000 Lang/Racket/Classes create mode 120000 Lang/Racket/Define_a_primitive_data_type create mode 120000 Lang/Racket/Detect_division_by_zero create mode 120000 Lang/Racket/Determine_if_a_string_is_numeric create mode 120000 Lang/Racket/Forest_fire create mode 120000 Lang/Ruby/Ackermann_function create mode 120000 Lang/Ruby/Arrays create mode 120000 Lang/Ruby/Assertions create mode 120000 Lang/Ruby/Balanced_brackets create mode 120000 Lang/Ruby/Balanced_ternary create mode 120000 Lang/Ruby/Binary_search create mode 120000 Lang/Ruby/Binary_strings create mode 120000 Lang/Ruby/Caesar_cipher create mode 120000 Lang/Ruby/Calendar create mode 120000 Lang/Ruby/Check_that_file_exists create mode 120000 Lang/Ruby/Checkpoint_synchronization create mode 120000 Lang/Ruby/Classes create mode 120000 Lang/Ruby/Closest-pair_problem create mode 120000 Lang/Ruby/Collections create mode 120000 Lang/Ruby/Define_a_primitive_data_type create mode 120000 Lang/Ruby/Delegates create mode 120000 Lang/Ruby/Delete_a_file create mode 120000 Lang/Ruby/Detect_division_by_zero create mode 120000 Lang/Ruby/Determine_if_a_string_is_numeric create mode 120000 Lang/Ruby/Forest_fire create mode 120000 Lang/SNUSP/Ackermann_function create mode 120000 Lang/Sather/Ackermann_function create mode 120000 Lang/Sather/Arrays create mode 120000 Lang/Sather/Assertions create mode 120000 Lang/Sather/Classes create mode 120000 Lang/Sather/Forest_fire create mode 120000 Lang/Scala/Ackermann_function create mode 120000 Lang/Scala/Arrays create mode 120000 Lang/Scala/Assertions create mode 120000 Lang/Scala/Balanced_brackets create mode 120000 Lang/Scala/Binary_search create mode 120000 Lang/Scala/Caesar_cipher create mode 120000 Lang/Scala/Calendar create mode 120000 Lang/Scala/Classes create mode 120000 Lang/Scala/Closest-pair_problem create mode 120000 Lang/Scala/Collections create mode 120000 Lang/Scala/Detect_division_by_zero create mode 120000 Lang/Scala/Determine_if_a_string_is_numeric create mode 120000 Lang/Scala/Forest_fire create mode 120000 Lang/Scheme/Ackermann_function create mode 120000 Lang/Scheme/Arrays create mode 120000 Lang/Scheme/Assertions create mode 120000 Lang/Scheme/Balanced_brackets create mode 120000 Lang/Scheme/Best_shuffle create mode 120000 Lang/Scheme/Binary_search create mode 120000 Lang/Scheme/Check_that_file_exists create mode 120000 Lang/Scheme/Classes create mode 120000 Lang/Scheme/Collections create mode 120000 Lang/Scheme/Delete_a_file create mode 120000 Lang/Scheme/Determine_if_a_string_is_numeric create mode 120000 Lang/Smalltalk/Ackermann_function create mode 120000 Lang/Smalltalk/Arrays create mode 120000 Lang/Smalltalk/Assertions create mode 120000 Lang/Smalltalk/Caesar_cipher create mode 120000 Lang/Smalltalk/Check_that_file_exists create mode 120000 Lang/Smalltalk/Classes create mode 120000 Lang/Smalltalk/Collections create mode 120000 Lang/Smalltalk/Delete_a_file create mode 120000 Lang/Smalltalk/Detect_division_by_zero create mode 120000 Lang/Smalltalk/Determine_if_a_string_is_numeric create mode 120000 Lang/Tcl/Ackermann_function create mode 120000 Lang/Tcl/Arrays create mode 120000 Lang/Tcl/Assertions create mode 120000 Lang/Tcl/Balanced_brackets create mode 120000 Lang/Tcl/Balanced_ternary create mode 120000 Lang/Tcl/Best_shuffle create mode 120000 Lang/Tcl/Binary_search create mode 120000 Lang/Tcl/Binary_strings create mode 120000 Lang/Tcl/Caesar_cipher create mode 120000 Lang/Tcl/Calendar create mode 120000 Lang/Tcl/Check_that_file_exists create mode 120000 Lang/Tcl/Checkpoint_synchronization create mode 120000 Lang/Tcl/Classes create mode 120000 Lang/Tcl/Closest-pair_problem create mode 120000 Lang/Tcl/Collections create mode 120000 Lang/Tcl/Color_of_a_screen_pixel create mode 120000 Lang/Tcl/Define_a_primitive_data_type create mode 120000 Lang/Tcl/Delegates create mode 120000 Lang/Tcl/Delete_a_file create mode 120000 Lang/Tcl/Detect_division_by_zero create mode 120000 Lang/Tcl/Determine_if_a_string_is_numeric create mode 120000 Lang/Tcl/Forest_fire create mode 100644 Task/Ackermann_function/0DESCRIPTION create mode 100644 Task/Ackermann_function/1META.yaml create mode 100644 Task/Ackermann_function/AWK/ackermann_function.awk create mode 100644 Task/Ackermann_function/ActionScript/ackermann_function.as create mode 100644 Task/Ackermann_function/BASIC/ackermann_function.bas create mode 100644 Task/Ackermann_function/Babel/ackermann_function.pb create mode 100644 Task/Ackermann_function/Befunge/ackermann_function.bf create mode 100644 Task/Ackermann_function/C/ackermann_function-2.c create mode 100644 Task/Ackermann_function/C/ackermann_function.c create mode 100644 Task/Ackermann_function/Clojure/ackermann_function.clj create mode 100644 Task/Ackermann_function/CoffeeScript/ackermann_function.coffee create mode 100644 Task/Ackermann_function/Dylan/ackermann_function.dylan create mode 100644 Task/Ackermann_function/Eiffel/ackermann_function.e create mode 100644 Task/Ackermann_function/Erlang/ackermann_function.erl create mode 100644 Task/Ackermann_function/Forth/ackermann_function-2.fth create mode 100644 Task/Ackermann_function/Forth/ackermann_function.fth create mode 100644 Task/Ackermann_function/Fortran/ackermann_function.f create mode 100644 Task/Ackermann_function/Go/ackermann_function-2.go create mode 100644 Task/Ackermann_function/Go/ackermann_function-3.go create mode 100644 Task/Ackermann_function/Go/ackermann_function.go create mode 100644 Task/Ackermann_function/Haskell/ackermann_function-2.hs create mode 100644 Task/Ackermann_function/Haskell/ackermann_function.hs create mode 100644 Task/Ackermann_function/Java/ackermann_function.java create mode 100644 Task/Ackermann_function/JavaScript/ackermann_function.js create mode 100644 Task/Ackermann_function/Lua/ackermann_function.lua create mode 100644 Task/Ackermann_function/PHP/ackermann_function.php create mode 100644 Task/Ackermann_function/Perl/ackermann_function-2.pl create mode 100644 Task/Ackermann_function/Perl/ackermann_function-3.pl create mode 100644 Task/Ackermann_function/Perl/ackermann_function.pl create mode 100644 Task/Ackermann_function/PicoLisp/ackermann_function.l create mode 100644 Task/Ackermann_function/Prolog/ackermann_function.pro create mode 100644 Task/Ackermann_function/Python/ackermann_function-2.py create mode 100644 Task/Ackermann_function/Python/ackermann_function-3.py create mode 100644 Task/Ackermann_function/Python/ackermann_function-4.py create mode 100644 Task/Ackermann_function/Python/ackermann_function.py create mode 100644 Task/Ackermann_function/R/ackermann_function-2.r create mode 100644 Task/Ackermann_function/R/ackermann_function.r create mode 100644 Task/Ackermann_function/REXX/ackermann_function-2.rexx create mode 100644 Task/Ackermann_function/REXX/ackermann_function-3.rexx create mode 100644 Task/Ackermann_function/REXX/ackermann_function.rexx create mode 100644 Task/Ackermann_function/Racket/ackermann_function.rkt create mode 100644 Task/Ackermann_function/Ruby/ackermann_function-2.rb create mode 100644 Task/Ackermann_function/Ruby/ackermann_function.rb create mode 100644 Task/Ackermann_function/SNUSP/ackermann_function.snusp create mode 100644 Task/Ackermann_function/Sather/ackermann_function-2.sa create mode 100644 Task/Ackermann_function/Sather/ackermann_function.sa create mode 100644 Task/Ackermann_function/Scala/ackermann_function-2.scala create mode 100644 Task/Ackermann_function/Scala/ackermann_function-3.scala create mode 100644 Task/Ackermann_function/Scala/ackermann_function-4.scala create mode 100644 Task/Ackermann_function/Scala/ackermann_function.scala create mode 100644 Task/Ackermann_function/Scheme/ackermann_function.ss create mode 100644 Task/Ackermann_function/Smalltalk/ackermann_function.st create mode 100644 Task/Ackermann_function/Tcl/ackermann_function-2.tcl create mode 100644 Task/Ackermann_function/Tcl/ackermann_function-3.tcl create mode 100644 Task/Ackermann_function/Tcl/ackermann_function.tcl create mode 100644 Task/Arrays/0DESCRIPTION create mode 100644 Task/Arrays/1META.yaml create mode 100644 Task/Arrays/AWK/arrays.awk create mode 100644 Task/Arrays/ActionScript/arrays.as create mode 100644 Task/Arrays/BASIC/arrays-2.bas create mode 100644 Task/Arrays/BASIC/arrays-3.bas create mode 100644 Task/Arrays/BASIC/arrays-4.bas create mode 100644 Task/Arrays/BASIC/arrays-5.bas create mode 100644 Task/Arrays/BASIC/arrays-6.bas create mode 100644 Task/Arrays/BASIC/arrays-7.bas create mode 100644 Task/Arrays/BASIC/arrays-8.bas create mode 100644 Task/Arrays/BASIC/arrays.bas create mode 100644 Task/Arrays/C/arrays-2.c create mode 100644 Task/Arrays/C/arrays-3.c create mode 100644 Task/Arrays/C/arrays-4.c create mode 100644 Task/Arrays/C/arrays-5.c create mode 100644 Task/Arrays/C/arrays-6.c create mode 100644 Task/Arrays/C/arrays-7.c create mode 100644 Task/Arrays/C/arrays-8.c create mode 100644 Task/Arrays/C/arrays-9.c create mode 100644 Task/Arrays/C/arrays.c create mode 100644 Task/Arrays/Clojure/arrays.clj create mode 100644 Task/Arrays/CoffeeScript/arrays-2.coffee create mode 100644 Task/Arrays/CoffeeScript/arrays-3.coffee create mode 100644 Task/Arrays/CoffeeScript/arrays.coffee create mode 100644 Task/Arrays/Eiffel/arrays.e create mode 100644 Task/Arrays/Erlang/arrays.erl create mode 100644 Task/Arrays/Forth/arrays-2.fth create mode 100644 Task/Arrays/Forth/arrays-3.fth create mode 100644 Task/Arrays/Forth/arrays.fth create mode 100644 Task/Arrays/Fortran/arrays-10.f create mode 100644 Task/Arrays/Fortran/arrays-11.f create mode 100644 Task/Arrays/Fortran/arrays-12.f create mode 100644 Task/Arrays/Fortran/arrays-13.f create mode 100644 Task/Arrays/Fortran/arrays-14.f create mode 100644 Task/Arrays/Fortran/arrays-15.f create mode 100644 Task/Arrays/Fortran/arrays-16.f create mode 100644 Task/Arrays/Fortran/arrays-17.f create mode 100644 Task/Arrays/Fortran/arrays-18.f create mode 100644 Task/Arrays/Fortran/arrays-19.f create mode 100644 Task/Arrays/Fortran/arrays-2.f create mode 100644 Task/Arrays/Fortran/arrays-20.f create mode 100644 Task/Arrays/Fortran/arrays-21.f create mode 100644 Task/Arrays/Fortran/arrays-22.f create mode 100644 Task/Arrays/Fortran/arrays-23.f create mode 100644 Task/Arrays/Fortran/arrays-24.f create mode 100644 Task/Arrays/Fortran/arrays-25.f create mode 100644 Task/Arrays/Fortran/arrays-26.f create mode 100644 Task/Arrays/Fortran/arrays-27.f create mode 100644 Task/Arrays/Fortran/arrays-28.f create mode 100644 Task/Arrays/Fortran/arrays-29.f create mode 100644 Task/Arrays/Fortran/arrays-3.f create mode 100644 Task/Arrays/Fortran/arrays-30.f create mode 100644 Task/Arrays/Fortran/arrays-31.f create mode 100644 Task/Arrays/Fortran/arrays-32.f create mode 100644 Task/Arrays/Fortran/arrays-33.f create mode 100644 Task/Arrays/Fortran/arrays-34.f create mode 100644 Task/Arrays/Fortran/arrays-35.f create mode 100644 Task/Arrays/Fortran/arrays-36.f create mode 100644 Task/Arrays/Fortran/arrays-37.f create mode 100644 Task/Arrays/Fortran/arrays-38.f create mode 100644 Task/Arrays/Fortran/arrays-39.f create mode 100644 Task/Arrays/Fortran/arrays-4.f create mode 100644 Task/Arrays/Fortran/arrays-40.f create mode 100644 Task/Arrays/Fortran/arrays-41.f create mode 100644 Task/Arrays/Fortran/arrays-5.f create mode 100644 Task/Arrays/Fortran/arrays-6.f create mode 100644 Task/Arrays/Fortran/arrays-7.f create mode 100644 Task/Arrays/Fortran/arrays-8.f create mode 100644 Task/Arrays/Fortran/arrays-9.f create mode 100644 Task/Arrays/Fortran/arrays.f create mode 100644 Task/Arrays/Go/arrays.go create mode 100644 Task/Arrays/Haskell/arrays.hs create mode 100644 Task/Arrays/Java/arrays-2.java create mode 100644 Task/Arrays/Java/arrays.java create mode 100644 Task/Arrays/JavaScript/arrays.js create mode 100644 Task/Arrays/Lua/arrays.lua create mode 100644 Task/Arrays/PHP/arrays-10.php create mode 100644 Task/Arrays/PHP/arrays-11.php create mode 100644 Task/Arrays/PHP/arrays-12.php create mode 100644 Task/Arrays/PHP/arrays-2.php create mode 100644 Task/Arrays/PHP/arrays-3.php create mode 100644 Task/Arrays/PHP/arrays-4.php create mode 100644 Task/Arrays/PHP/arrays-5.php create mode 100644 Task/Arrays/PHP/arrays-6.php create mode 100644 Task/Arrays/PHP/arrays-7.php create mode 100644 Task/Arrays/PHP/arrays-8.php create mode 100644 Task/Arrays/PHP/arrays-9.php create mode 100644 Task/Arrays/PHP/arrays.php create mode 100644 Task/Arrays/Perl/arrays.pl create mode 100644 Task/Arrays/PicoLisp/arrays-2.l create mode 100644 Task/Arrays/PicoLisp/arrays-3.l create mode 100644 Task/Arrays/PicoLisp/arrays-4.l create mode 100644 Task/Arrays/PicoLisp/arrays.l create mode 100644 Task/Arrays/Prolog/arrays-2.pro create mode 100644 Task/Arrays/Prolog/arrays-3.pro create mode 100644 Task/Arrays/Prolog/arrays.pro create mode 100644 Task/Arrays/Python/arrays-2.py create mode 100644 Task/Arrays/Python/arrays-3.py create mode 100644 Task/Arrays/Python/arrays-4.py create mode 100644 Task/Arrays/Python/arrays-5.py create mode 100644 Task/Arrays/Python/arrays-6.py create mode 100644 Task/Arrays/Python/arrays-7.py create mode 100644 Task/Arrays/Python/arrays.py create mode 100644 Task/Arrays/R/arrays.r create mode 100644 Task/Arrays/REXX/arrays-2.rexx create mode 100644 Task/Arrays/REXX/arrays-3.rexx create mode 100644 Task/Arrays/REXX/arrays-4.rexx create mode 100644 Task/Arrays/REXX/arrays-5.rexx create mode 100644 Task/Arrays/REXX/arrays-6.rexx create mode 100644 Task/Arrays/REXX/arrays.rexx create mode 100644 Task/Arrays/Racket/arrays.rkt create mode 100644 Task/Arrays/Ruby/arrays.rb create mode 100644 Task/Arrays/Sather/arrays.sa create mode 100644 Task/Arrays/Scala/arrays-2.scala create mode 100644 Task/Arrays/Scala/arrays.scala create mode 100644 Task/Arrays/Scheme/arrays.ss create mode 100644 Task/Arrays/Smalltalk/arrays-2.st create mode 100644 Task/Arrays/Smalltalk/arrays-3.st create mode 100644 Task/Arrays/Smalltalk/arrays-4.st create mode 100644 Task/Arrays/Smalltalk/arrays-5.st create mode 100644 Task/Arrays/Smalltalk/arrays-6.st create mode 100644 Task/Arrays/Smalltalk/arrays-7.st create mode 100644 Task/Arrays/Smalltalk/arrays.st create mode 100644 Task/Arrays/Tcl/arrays-2.tcl create mode 100644 Task/Arrays/Tcl/arrays.tcl create mode 100644 Task/Assertions/0DESCRIPTION create mode 100644 Task/Assertions/1META.yaml create mode 100644 Task/Assertions/C/assertions-2.c create mode 100644 Task/Assertions/C/assertions.c create mode 100644 Task/Assertions/Clojure/assertions.clj create mode 100644 Task/Assertions/Eiffel/assertions-2.e create mode 100644 Task/Assertions/Eiffel/assertions.e create mode 100644 Task/Assertions/Erlang/assertions.erl create mode 100644 Task/Assertions/Go/assertions.go create mode 100644 Task/Assertions/Haskell/assertions.hs create mode 100644 Task/Assertions/Java/assertions.java create mode 100644 Task/Assertions/Lua/assertions.lua create mode 100644 Task/Assertions/PHP/assertions.php create mode 100644 Task/Assertions/Perl/assertions-2.pl create mode 100644 Task/Assertions/Perl/assertions-3.pl create mode 100644 Task/Assertions/Perl/assertions-4.pl create mode 100644 Task/Assertions/Perl/assertions-5.pl create mode 100644 Task/Assertions/Perl/assertions.pl create mode 100644 Task/Assertions/PicoLisp/assertions-2.l create mode 100644 Task/Assertions/PicoLisp/assertions-3.l create mode 100644 Task/Assertions/PicoLisp/assertions.l create mode 100644 Task/Assertions/Prolog/assertions.pro create mode 100644 Task/Assertions/Python/assertions.py create mode 100644 Task/Assertions/R/assertions.r create mode 100644 Task/Assertions/REXX/assertions.rexx create mode 100644 Task/Assertions/Racket/assertions-2.rkt create mode 100644 Task/Assertions/Racket/assertions.rkt create mode 100644 Task/Assertions/Ruby/assertions.rb create mode 100644 Task/Assertions/Sather/assertions.sa create mode 100644 Task/Assertions/Scala/assertions-2.scala create mode 100644 Task/Assertions/Scala/assertions-3.scala create mode 100644 Task/Assertions/Scala/assertions.scala create mode 100644 Task/Assertions/Scheme/assertions.ss create mode 100644 Task/Assertions/Smalltalk/assertions-2.st create mode 100644 Task/Assertions/Smalltalk/assertions-3.st create mode 100644 Task/Assertions/Smalltalk/assertions.st create mode 100644 Task/Assertions/Tcl/assertions.tcl create mode 100644 Task/Balanced_brackets/0DESCRIPTION create mode 100644 Task/Balanced_brackets/AWK/balanced_brackets.awk create mode 100644 Task/Balanced_brackets/BASIC/balanced_brackets.bas create mode 100644 Task/Balanced_brackets/Befunge/balanced_brackets.bf create mode 100644 Task/Balanced_brackets/C/balanced_brackets-2.c create mode 100644 Task/Balanced_brackets/C/balanced_brackets.c create mode 100644 Task/Balanced_brackets/Clojure/balanced_brackets.clj create mode 100644 Task/Balanced_brackets/CoffeeScript/balanced_brackets-2.coffee create mode 100644 Task/Balanced_brackets/CoffeeScript/balanced_brackets.coffee create mode 100644 Task/Balanced_brackets/Forth/balanced_brackets.fth create mode 100644 Task/Balanced_brackets/Go/balanced_brackets.go create mode 100644 Task/Balanced_brackets/Haskell/balanced_brackets-2.hs create mode 100644 Task/Balanced_brackets/Haskell/balanced_brackets.hs create mode 100644 Task/Balanced_brackets/Java/balanced_brackets.java create mode 100644 Task/Balanced_brackets/JavaScript/balanced_brackets-2.js create mode 100644 Task/Balanced_brackets/JavaScript/balanced_brackets.js create mode 100644 Task/Balanced_brackets/Lua/balanced_brackets.lua create mode 100644 Task/Balanced_brackets/Perl/balanced_brackets-2.pl create mode 100644 Task/Balanced_brackets/Perl/balanced_brackets.pl create mode 100644 Task/Balanced_brackets/PicoLisp/balanced_brackets.l create mode 100644 Task/Balanced_brackets/Prolog/balanced_brackets.pro create mode 100644 Task/Balanced_brackets/Python/balanced_brackets.py create mode 100644 Task/Balanced_brackets/R/balanced_brackets-2.r create mode 100644 Task/Balanced_brackets/R/balanced_brackets-3.r create mode 100644 Task/Balanced_brackets/R/balanced_brackets-4.r create mode 100644 Task/Balanced_brackets/R/balanced_brackets.r create mode 100644 Task/Balanced_brackets/REXX/balanced_brackets-2.rexx create mode 100644 Task/Balanced_brackets/REXX/balanced_brackets-3.rexx create mode 100644 Task/Balanced_brackets/REXX/balanced_brackets.rexx create mode 100644 Task/Balanced_brackets/Racket/balanced_brackets.rkt create mode 100644 Task/Balanced_brackets/Ruby/balanced_brackets.rb create mode 100644 Task/Balanced_brackets/Scala/balanced_brackets.scala create mode 100644 Task/Balanced_brackets/Scheme/balanced_brackets.ss create mode 100644 Task/Balanced_brackets/Tcl/balanced_brackets-2.tcl create mode 100644 Task/Balanced_brackets/Tcl/balanced_brackets.tcl create mode 100644 Task/Balanced_ternary/0DESCRIPTION create mode 100644 Task/Balanced_ternary/Erlang/balanced_ternary-2.erl create mode 100644 Task/Balanced_ternary/Erlang/balanced_ternary.erl create mode 100644 Task/Balanced_ternary/Go/balanced_ternary.go create mode 100644 Task/Balanced_ternary/Haskell/balanced_ternary.hs create mode 100644 Task/Balanced_ternary/Prolog/balanced_ternary-2.pro create mode 100644 Task/Balanced_ternary/Prolog/balanced_ternary-3.pro create mode 100644 Task/Balanced_ternary/Prolog/balanced_ternary.pro create mode 100644 Task/Balanced_ternary/Python/balanced_ternary.py create mode 100644 Task/Balanced_ternary/REXX/balanced_ternary.rexx create mode 100644 Task/Balanced_ternary/Ruby/balanced_ternary.rb create mode 100644 Task/Balanced_ternary/Tcl/balanced_ternary-2.tcl create mode 100644 Task/Balanced_ternary/Tcl/balanced_ternary.tcl create mode 100644 Task/Best_shuffle/0DESCRIPTION create mode 100644 Task/Best_shuffle/AWK/best_shuffle-2.awk create mode 100644 Task/Best_shuffle/AWK/best_shuffle-3.awk create mode 100644 Task/Best_shuffle/AWK/best_shuffle.awk create mode 100644 Task/Best_shuffle/C/best_shuffle-2.c create mode 100644 Task/Best_shuffle/C/best_shuffle-3.c create mode 100644 Task/Best_shuffle/C/best_shuffle-4.c create mode 100644 Task/Best_shuffle/C/best_shuffle.c create mode 100644 Task/Best_shuffle/Clojure/best_shuffle.clj create mode 100644 Task/Best_shuffle/Go/best_shuffle.go create mode 100644 Task/Best_shuffle/Haskell/best_shuffle-2.hs create mode 100644 Task/Best_shuffle/Haskell/best_shuffle.hs create mode 100644 Task/Best_shuffle/Java/best_shuffle.java create mode 100644 Task/Best_shuffle/JavaScript/best_shuffle-2.js create mode 100644 Task/Best_shuffle/JavaScript/best_shuffle-3.js create mode 100644 Task/Best_shuffle/JavaScript/best_shuffle.js create mode 100644 Task/Best_shuffle/PHP/best_shuffle.php create mode 100644 Task/Best_shuffle/Perl/best_shuffle.pl create mode 100644 Task/Best_shuffle/PicoLisp/best_shuffle.l create mode 100644 Task/Best_shuffle/Prolog/best_shuffle.pro create mode 100644 Task/Best_shuffle/Python/best_shuffle-2.py create mode 100644 Task/Best_shuffle/Python/best_shuffle.py create mode 100644 Task/Best_shuffle/REXX/best_shuffle-2.rexx create mode 100644 Task/Best_shuffle/REXX/best_shuffle-3.rexx create mode 100644 Task/Best_shuffle/REXX/best_shuffle.rexx create mode 100644 Task/Best_shuffle/Racket/best_shuffle.rkt create mode 100644 Task/Best_shuffle/Scheme/best_shuffle.ss create mode 100644 Task/Best_shuffle/Tcl/best_shuffle-2.tcl create mode 100644 Task/Best_shuffle/Tcl/best_shuffle.tcl create mode 100644 Task/Binary_digits/0DESCRIPTION create mode 100644 Task/Binary_digits/1META.yaml create mode 100644 Task/Binary_digits/AWK/binary_digits.awk create mode 100644 Task/Binary_digits/C/binary_digits-2.c create mode 100644 Task/Binary_digits/C/binary_digits.c create mode 100644 Task/Binary_digits/Clojure/binary_digits.clj create mode 100644 Task/Binary_digits/CoffeeScript/binary_digits.coffee create mode 100644 Task/Binary_digits/Erlang/binary_digits.erl create mode 100644 Task/Binary_digits/Forth/binary_digits.fth create mode 100644 Task/Binary_digits/Go/binary_digits.go create mode 100644 Task/Binary_digits/Haskell/binary_digits.hs create mode 100644 Task/Binary_digits/Java/binary_digits.java create mode 100644 Task/Binary_digits/JavaScript/binary_digits.js create mode 100644 Task/Binary_digits/PHP/binary_digits.php create mode 100644 Task/Binary_digits/Perl/binary_digits.pl create mode 100644 Task/Binary_digits/PicoLisp/binary_digits.l create mode 100644 Task/Binary_digits/Python/binary_digits-2.py create mode 100644 Task/Binary_digits/Python/binary_digits-3.py create mode 100644 Task/Binary_digits/Python/binary_digits.py create mode 100644 Task/Binary_digits/Racket/binary_digits.rkt create mode 100644 Task/Binary_search/0DESCRIPTION create mode 100644 Task/Binary_search/1META.yaml create mode 100644 Task/Binary_search/AWK/binary_search-2.awk create mode 100644 Task/Binary_search/AWK/binary_search.awk create mode 100644 Task/Binary_search/BASIC/binary_search-2.bas create mode 100644 Task/Binary_search/BASIC/binary_search-3.bas create mode 100644 Task/Binary_search/BASIC/binary_search.bas create mode 100644 Task/Binary_search/C/binary_search-2.c create mode 100644 Task/Binary_search/C/binary_search-3.c create mode 100644 Task/Binary_search/C/binary_search.c create mode 100644 Task/Binary_search/Clojure/binary_search.clj create mode 100644 Task/Binary_search/CoffeeScript/binary_search.coffee create mode 100644 Task/Binary_search/Erlang/binary_search.erl create mode 100644 Task/Binary_search/Forth/binary_search.fth create mode 100644 Task/Binary_search/Fortran/binary_search-2.f create mode 100644 Task/Binary_search/Fortran/binary_search.f create mode 100644 Task/Binary_search/Go/binary_search-2.go create mode 100644 Task/Binary_search/Go/binary_search-3.go create mode 100644 Task/Binary_search/Go/binary_search.go create mode 100644 Task/Binary_search/Haskell/binary_search-2.hs create mode 100644 Task/Binary_search/Haskell/binary_search.hs create mode 100644 Task/Binary_search/Java/binary_search-2.java create mode 100644 Task/Binary_search/Java/binary_search-3.java create mode 100644 Task/Binary_search/Java/binary_search-4.java create mode 100644 Task/Binary_search/Java/binary_search.java create mode 100644 Task/Binary_search/JavaScript/binary_search-2.js create mode 100644 Task/Binary_search/JavaScript/binary_search.js create mode 100644 Task/Binary_search/Lua/binary_search-2.lua create mode 100644 Task/Binary_search/Lua/binary_search.lua create mode 100644 Task/Binary_search/PHP/binary_search-2.php create mode 100644 Task/Binary_search/PHP/binary_search.php create mode 100644 Task/Binary_search/Perl/binary_search-2.pl create mode 100644 Task/Binary_search/Perl/binary_search.pl create mode 100644 Task/Binary_search/PicoLisp/binary_search-2.l create mode 100644 Task/Binary_search/PicoLisp/binary_search.l create mode 100644 Task/Binary_search/Python/binary_search-2.py create mode 100644 Task/Binary_search/Python/binary_search-3.py create mode 100644 Task/Binary_search/Python/binary_search.py create mode 100644 Task/Binary_search/R/binary_search-2.r create mode 100644 Task/Binary_search/R/binary_search-3.r create mode 100644 Task/Binary_search/R/binary_search.r create mode 100644 Task/Binary_search/REXX/binary_search-2.rexx create mode 100644 Task/Binary_search/REXX/binary_search.rexx create mode 100644 Task/Binary_search/Racket/binary_search.rkt create mode 100644 Task/Binary_search/Ruby/binary_search-2.rb create mode 100644 Task/Binary_search/Ruby/binary_search.rb create mode 100644 Task/Binary_search/Scala/binary_search.scala create mode 100644 Task/Binary_search/Scheme/binary_search.ss create mode 100644 Task/Binary_search/Tcl/binary_search-2.tcl create mode 100644 Task/Binary_search/Tcl/binary_search.tcl create mode 100644 Task/Binary_strings/0DESCRIPTION create mode 100644 Task/Binary_strings/1META.yaml create mode 100644 Task/Binary_strings/BASIC/binary_strings.bas create mode 100644 Task/Binary_strings/C/binary_strings.c create mode 100644 Task/Binary_strings/Forth/binary_strings-2.fth create mode 100644 Task/Binary_strings/Forth/binary_strings.fth create mode 100644 Task/Binary_strings/Go/binary_strings.go create mode 100644 Task/Binary_strings/Haskell/binary_strings-2.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings-3.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings-4.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings-5.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings-6.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings-7.hs create mode 100644 Task/Binary_strings/Haskell/binary_strings.hs create mode 100644 Task/Binary_strings/Lua/binary_strings.lua create mode 100644 Task/Binary_strings/PicoLisp/binary_strings-2.l create mode 100644 Task/Binary_strings/PicoLisp/binary_strings-3.l create mode 100644 Task/Binary_strings/PicoLisp/binary_strings-4.l create mode 100644 Task/Binary_strings/PicoLisp/binary_strings.l create mode 100644 Task/Binary_strings/Python/binary_strings-10.py create mode 100644 Task/Binary_strings/Python/binary_strings-11.py create mode 100644 Task/Binary_strings/Python/binary_strings-12.py create mode 100644 Task/Binary_strings/Python/binary_strings-13.py create mode 100644 Task/Binary_strings/Python/binary_strings-14.py create mode 100644 Task/Binary_strings/Python/binary_strings-2.py create mode 100644 Task/Binary_strings/Python/binary_strings-3.py create mode 100644 Task/Binary_strings/Python/binary_strings-4.py create mode 100644 Task/Binary_strings/Python/binary_strings-5.py create mode 100644 Task/Binary_strings/Python/binary_strings-6.py create mode 100644 Task/Binary_strings/Python/binary_strings-7.py create mode 100644 Task/Binary_strings/Python/binary_strings-8.py create mode 100644 Task/Binary_strings/Python/binary_strings-9.py create mode 100644 Task/Binary_strings/Python/binary_strings.py create mode 100644 Task/Binary_strings/REXX/binary_strings.rexx create mode 100644 Task/Binary_strings/Racket/binary_strings.rkt create mode 100644 Task/Binary_strings/Ruby/binary_strings.rb create mode 100644 Task/Binary_strings/Tcl/binary_strings.tcl create mode 100644 Task/Caesar_cipher/0DESCRIPTION create mode 100644 Task/Caesar_cipher/1META.yaml create mode 100644 Task/Caesar_cipher/AWK/caesar_cipher.awk create mode 100644 Task/Caesar_cipher/C/caesar_cipher.c create mode 100644 Task/Caesar_cipher/Clojure/caesar_cipher.clj create mode 100644 Task/Caesar_cipher/CoffeeScript/caesar_cipher.coffee create mode 100644 Task/Caesar_cipher/Erlang/caesar_cipher-2.erl create mode 100644 Task/Caesar_cipher/Erlang/caesar_cipher.erl create mode 100644 Task/Caesar_cipher/Forth/caesar_cipher.fth create mode 100644 Task/Caesar_cipher/Fortran/caesar_cipher.f create mode 100644 Task/Caesar_cipher/Go/caesar_cipher-2.go create mode 100644 Task/Caesar_cipher/Go/caesar_cipher.go create mode 100644 Task/Caesar_cipher/Haskell/caesar_cipher.hs create mode 100644 Task/Caesar_cipher/Java/caesar_cipher.java create mode 100644 Task/Caesar_cipher/JavaScript/caesar_cipher.js create mode 100644 Task/Caesar_cipher/Lua/caesar_cipher.lua create mode 100644 Task/Caesar_cipher/PHP/caesar_cipher.php create mode 100644 Task/Caesar_cipher/Perl/caesar_cipher.pl create mode 100644 Task/Caesar_cipher/PicoLisp/caesar_cipher.l create mode 100644 Task/Caesar_cipher/Prolog/caesar_cipher.pro create mode 100644 Task/Caesar_cipher/Python/caesar_cipher-2.py create mode 100644 Task/Caesar_cipher/Python/caesar_cipher-3.py create mode 100644 Task/Caesar_cipher/Python/caesar_cipher.py create mode 100644 Task/Caesar_cipher/REXX/caesar_cipher-2.rexx create mode 100644 Task/Caesar_cipher/REXX/caesar_cipher.rexx create mode 100644 Task/Caesar_cipher/Racket/caesar_cipher-2.rkt create mode 100644 Task/Caesar_cipher/Racket/caesar_cipher.rkt create mode 100644 Task/Caesar_cipher/Ruby/caesar_cipher.rb create mode 100644 Task/Caesar_cipher/Scala/caesar_cipher-2.scala create mode 100644 Task/Caesar_cipher/Scala/caesar_cipher.scala create mode 100644 Task/Caesar_cipher/Smalltalk/caesar_cipher-2.st create mode 100644 Task/Caesar_cipher/Smalltalk/caesar_cipher.st create mode 100644 Task/Caesar_cipher/Tcl/caesar_cipher-2.tcl create mode 100644 Task/Caesar_cipher/Tcl/caesar_cipher.tcl create mode 100644 Task/Calendar/0DESCRIPTION create mode 100644 Task/Calendar/1META.yaml create mode 100644 Task/Calendar/C/calendar.c create mode 100644 Task/Calendar/Perl/calendar.pl create mode 100644 Task/Calendar/PicoLisp/calendar.l create mode 100644 Task/Calendar/Python/calendar.py create mode 100644 Task/Calendar/REXX/calendar.rexx create mode 100644 Task/Calendar/Ruby/calendar.rb create mode 100644 Task/Calendar/Scala/calendar.scala create mode 100644 Task/Calendar/Tcl/calendar-2.tcl create mode 100644 Task/Calendar/Tcl/calendar-3.tcl create mode 100644 Task/Calendar/Tcl/calendar.tcl create mode 100644 Task/Check_that_file_exists/0DESCRIPTION create mode 100644 Task/Check_that_file_exists/1META.yaml create mode 100644 Task/Check_that_file_exists/BASIC/check_that_file_exists-2.bas create mode 100644 Task/Check_that_file_exists/BASIC/check_that_file_exists-3.bas create mode 100644 Task/Check_that_file_exists/BASIC/check_that_file_exists.bas create mode 100644 Task/Check_that_file_exists/C/check_that_file_exists.c create mode 100644 Task/Check_that_file_exists/Clojure/check_that_file_exists.clj create mode 100644 Task/Check_that_file_exists/Erlang/check_that_file_exists.erl create mode 100644 Task/Check_that_file_exists/Forth/check_that_file_exists.fth create mode 100644 Task/Check_that_file_exists/Fortran/check_that_file_exists-2.f create mode 100644 Task/Check_that_file_exists/Fortran/check_that_file_exists.f create mode 100644 Task/Check_that_file_exists/Go/check_that_file_exists.go create mode 100644 Task/Check_that_file_exists/Haskell/check_that_file_exists.hs create mode 100644 Task/Check_that_file_exists/Java/check_that_file_exists-2.java create mode 100644 Task/Check_that_file_exists/Java/check_that_file_exists.java create mode 100644 Task/Check_that_file_exists/JavaScript/check_that_file_exists.js create mode 100644 Task/Check_that_file_exists/Lua/check_that_file_exists-2.lua create mode 100644 Task/Check_that_file_exists/Lua/check_that_file_exists.lua create mode 100644 Task/Check_that_file_exists/PHP/check_that_file_exists.php create mode 100644 Task/Check_that_file_exists/Perl/check_that_file_exists.pl create mode 100644 Task/Check_that_file_exists/PicoLisp/check_that_file_exists.l create mode 100644 Task/Check_that_file_exists/Python/check_that_file_exists.py create mode 100644 Task/Check_that_file_exists/R/check_that_file_exists.r create mode 100644 Task/Check_that_file_exists/Ruby/check_that_file_exists-2.rb create mode 100644 Task/Check_that_file_exists/Ruby/check_that_file_exists.rb create mode 100644 Task/Check_that_file_exists/Scheme/check_that_file_exists.ss create mode 100644 Task/Check_that_file_exists/Smalltalk/check_that_file_exists-2.st create mode 100644 Task/Check_that_file_exists/Smalltalk/check_that_file_exists.st create mode 100644 Task/Check_that_file_exists/Tcl/check_that_file_exists.tcl create mode 100644 Task/Checkpoint_synchronization/0DESCRIPTION create mode 100644 Task/Checkpoint_synchronization/1META.yaml create mode 100644 Task/Checkpoint_synchronization/C/checkpoint_synchronization.c create mode 100644 Task/Checkpoint_synchronization/Go/checkpoint_synchronization.go create mode 100644 Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization-2.hs create mode 100644 Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization.hs create mode 100644 Task/Checkpoint_synchronization/Java/checkpoint_synchronization-2.java create mode 100644 Task/Checkpoint_synchronization/Java/checkpoint_synchronization.java create mode 100644 Task/Checkpoint_synchronization/Perl/checkpoint_synchronization.pl create mode 100644 Task/Checkpoint_synchronization/PicoLisp/checkpoint_synchronization.l create mode 100644 Task/Checkpoint_synchronization/Ruby/checkpoint_synchronization.rb create mode 100644 Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization-2.tcl create mode 100644 Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization.tcl create mode 100644 Task/Classes/0DESCRIPTION create mode 100644 Task/Classes/1META.yaml create mode 100644 Task/Classes/ActionScript/classes.as create mode 100644 Task/Classes/BASIC/classes.bas create mode 100644 Task/Classes/C/classes.c create mode 100644 Task/Classes/CoffeeScript/classes.coffee create mode 100644 Task/Classes/Forth/classes-2.fth create mode 100644 Task/Classes/Forth/classes-3.fth create mode 100644 Task/Classes/Forth/classes-4.fth create mode 100644 Task/Classes/Forth/classes-5.fth create mode 100644 Task/Classes/Forth/classes-6.fth create mode 100644 Task/Classes/Forth/classes.fth create mode 100644 Task/Classes/Go/classes-2.go create mode 100644 Task/Classes/Go/classes.go create mode 100644 Task/Classes/Haskell/classes-2.hs create mode 100644 Task/Classes/Haskell/classes-3.hs create mode 100644 Task/Classes/Haskell/classes.hs create mode 100644 Task/Classes/Java/classes.java create mode 100644 Task/Classes/JavaScript/classes.js create mode 100644 Task/Classes/Lua/classes.lua create mode 100644 Task/Classes/PHP/classes.php create mode 100644 Task/Classes/Perl/classes-2.pl create mode 100644 Task/Classes/Perl/classes-3.pl create mode 100644 Task/Classes/Perl/classes-4.pl create mode 100644 Task/Classes/Perl/classes.pl create mode 100644 Task/Classes/PicoLisp/classes.l create mode 100644 Task/Classes/Python/classes-2.py create mode 100644 Task/Classes/Python/classes.py create mode 100644 Task/Classes/R/classes-2.r create mode 100644 Task/Classes/R/classes.r create mode 100644 Task/Classes/Racket/classes.rkt create mode 100644 Task/Classes/Ruby/classes.rb create mode 100644 Task/Classes/Sather/classes-2.sa create mode 100644 Task/Classes/Sather/classes.sa create mode 100644 Task/Classes/Scala/classes.scala create mode 100644 Task/Classes/Scheme/classes.ss create mode 100644 Task/Classes/Smalltalk/classes.st create mode 100644 Task/Classes/Tcl/classes.tcl create mode 100644 Task/Closest-pair_problem/0DESCRIPTION create mode 100644 Task/Closest-pair_problem/1META.yaml create mode 100644 Task/Closest-pair_problem/Clojure/closest_pair_problem.clj create mode 100644 Task/Closest-pair_problem/Go/closest_pair_problem-2.go create mode 100644 Task/Closest-pair_problem/Go/closest_pair_problem.go create mode 100644 Task/Closest-pair_problem/Haskell/closest_pair_problem-2.hs create mode 100644 Task/Closest-pair_problem/Haskell/closest_pair_problem.hs create mode 100644 Task/Closest-pair_problem/Java/closest_pair_problem.java create mode 100644 Task/Closest-pair_problem/JavaScript/closest_pair_problem.js create mode 100644 Task/Closest-pair_problem/Perl/closest_pair_problem.pl create mode 100644 Task/Closest-pair_problem/PicoLisp/closest_pair_problem.l create mode 100644 Task/Closest-pair_problem/Python/closest_pair_problem.py create mode 100644 Task/Closest-pair_problem/R/closest_pair_problem-2.r create mode 100644 Task/Closest-pair_problem/R/closest_pair_problem-3.r create mode 100644 Task/Closest-pair_problem/R/closest_pair_problem-4.r create mode 100644 Task/Closest-pair_problem/R/closest_pair_problem-5.r create mode 100644 Task/Closest-pair_problem/R/closest_pair_problem.r create mode 100644 Task/Closest-pair_problem/REXX/closest_pair_problem.rexx create mode 100644 Task/Closest-pair_problem/Ruby/closest_pair_problem.rb create mode 100644 Task/Closest-pair_problem/Scala/closest_pair_problem.scala create mode 100644 Task/Closest-pair_problem/Tcl/closest_pair_problem.tcl create mode 100644 Task/Collections/0DESCRIPTION create mode 100644 Task/Collections/1META.yaml create mode 100644 Task/Collections/AWK/collections-2.awk create mode 100644 Task/Collections/AWK/collections-3.awk create mode 100644 Task/Collections/AWK/collections-4.awk create mode 100644 Task/Collections/AWK/collections.awk create mode 100644 Task/Collections/C/collections-2.c create mode 100644 Task/Collections/C/collections.c create mode 100644 Task/Collections/Clojure/collections-2.clj create mode 100644 Task/Collections/Clojure/collections-3.clj create mode 100644 Task/Collections/Clojure/collections-4.clj create mode 100644 Task/Collections/Clojure/collections.clj create mode 100644 Task/Collections/Forth/collections-2.fth create mode 100644 Task/Collections/Forth/collections-3.fth create mode 100644 Task/Collections/Forth/collections.fth create mode 100644 Task/Collections/Go/collections.go create mode 100644 Task/Collections/Haskell/collections-2.hs create mode 100644 Task/Collections/Haskell/collections-3.hs create mode 100644 Task/Collections/Haskell/collections-4.hs create mode 100644 Task/Collections/Haskell/collections.hs create mode 100644 Task/Collections/Java/collections-2.java create mode 100644 Task/Collections/Java/collections-3.java create mode 100644 Task/Collections/Java/collections-4.java create mode 100644 Task/Collections/Java/collections.java create mode 100644 Task/Collections/JavaScript/collections-2.js create mode 100644 Task/Collections/JavaScript/collections.js create mode 100644 Task/Collections/Lua/collections.lua create mode 100644 Task/Collections/PHP/collections.php create mode 100644 Task/Collections/Perl/collections.pl create mode 100644 Task/Collections/PicoLisp/collections.l create mode 100644 Task/Collections/Python/collections.py create mode 100644 Task/Collections/R/collections-2.r create mode 100644 Task/Collections/R/collections-3.r create mode 100644 Task/Collections/R/collections-4.r create mode 100644 Task/Collections/R/collections-5.r create mode 100644 Task/Collections/R/collections-6.r create mode 100644 Task/Collections/R/collections-7.r create mode 100644 Task/Collections/R/collections-8.r create mode 100644 Task/Collections/R/collections.r create mode 100644 Task/Collections/REXX/collections-2.rexx create mode 100644 Task/Collections/REXX/collections-3.rexx create mode 100644 Task/Collections/REXX/collections-4.rexx create mode 100644 Task/Collections/REXX/collections-5.rexx create mode 100644 Task/Collections/REXX/collections.rexx create mode 100644 Task/Collections/Ruby/collections-2.rb create mode 100644 Task/Collections/Ruby/collections.rb create mode 100644 Task/Collections/Scala/collections.scala create mode 100644 Task/Collections/Scheme/collections-2.ss create mode 100644 Task/Collections/Scheme/collections-3.ss create mode 100644 Task/Collections/Scheme/collections-4.ss create mode 100644 Task/Collections/Scheme/collections-5.ss create mode 100644 Task/Collections/Scheme/collections-6.ss create mode 100644 Task/Collections/Scheme/collections-7.ss create mode 100644 Task/Collections/Scheme/collections-8.ss create mode 100644 Task/Collections/Scheme/collections-9.ss create mode 100644 Task/Collections/Scheme/collections.ss create mode 100644 Task/Collections/Smalltalk/collections.st create mode 100644 Task/Collections/Tcl/collections-2.tcl create mode 100644 Task/Collections/Tcl/collections-3.tcl create mode 100644 Task/Collections/Tcl/collections.tcl create mode 100644 Task/Color_of_a_screen_pixel/0DESCRIPTION create mode 100644 Task/Color_of_a_screen_pixel/1META.yaml create mode 100644 Task/Color_of_a_screen_pixel/BASIC/color_of_a_screen_pixel.bas create mode 100644 Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel-2.c create mode 100644 Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel.c create mode 100644 Task/Color_of_a_screen_pixel/Clojure/color_of_a_screen_pixel.clj create mode 100644 Task/Color_of_a_screen_pixel/Java/color_of_a_screen_pixel.java create mode 100644 Task/Color_of_a_screen_pixel/PHP/color_of_a_screen_pixel.php create mode 100644 Task/Color_of_a_screen_pixel/PicoLisp/color_of_a_screen_pixel.l create mode 100644 Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-2.py create mode 100644 Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-3.py create mode 100644 Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-4.py create mode 100644 Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-5.py create mode 100644 Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel.py create mode 100644 Task/Color_of_a_screen_pixel/Tcl/color_of_a_screen_pixel.tcl create mode 100644 Task/Deepcopy/0DESCRIPTION create mode 100644 Task/Deepcopy/Go/deepcopy-2.go create mode 100644 Task/Deepcopy/Go/deepcopy.go create mode 100644 Task/Deepcopy/JavaScript/deepcopy-2.js create mode 100644 Task/Deepcopy/JavaScript/deepcopy.js create mode 100644 Task/Define_a_primitive_data_type/0DESCRIPTION create mode 100644 Task/Define_a_primitive_data_type/1META.yaml create mode 100644 Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type-2.f create mode 100644 Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type.f create mode 100644 Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-2.hs create mode 100644 Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-3.hs create mode 100644 Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type.hs create mode 100644 Task/Define_a_primitive_data_type/Java/define_a_primitive_data_type.java create mode 100644 Task/Define_a_primitive_data_type/JavaScript/define_a_primitive_data_type.js create mode 100644 Task/Define_a_primitive_data_type/Perl/define_a_primitive_data_type.pl create mode 100644 Task/Define_a_primitive_data_type/PicoLisp/define_a_primitive_data_type.l create mode 100644 Task/Define_a_primitive_data_type/Python/define_a_primitive_data_type.py create mode 100644 Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type-2.rkt create mode 100644 Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type.rkt create mode 100644 Task/Define_a_primitive_data_type/Ruby/define_a_primitive_data_type.rb create mode 100644 Task/Define_a_primitive_data_type/Tcl/define_a_primitive_data_type.tcl create mode 100644 Task/Delegates/0DESCRIPTION create mode 100644 Task/Delegates/1META.yaml create mode 100644 Task/Delegates/C/delegates.c create mode 100644 Task/Delegates/CoffeeScript/delegates-2.coffee create mode 100644 Task/Delegates/CoffeeScript/delegates.coffee create mode 100644 Task/Delegates/Go/delegates.go create mode 100644 Task/Delegates/Java/delegates.java create mode 100644 Task/Delegates/JavaScript/delegates.js create mode 100644 Task/Delegates/PHP/delegates.php create mode 100644 Task/Delegates/Perl/delegates-2.pl create mode 100644 Task/Delegates/Perl/delegates.pl create mode 100644 Task/Delegates/PicoLisp/delegates.l create mode 100644 Task/Delegates/Python/delegates.py create mode 100644 Task/Delegates/Ruby/delegates-2.rb create mode 100644 Task/Delegates/Ruby/delegates.rb create mode 100644 Task/Delegates/Tcl/delegates-2.tcl create mode 100644 Task/Delegates/Tcl/delegates.tcl create mode 100644 Task/Delete_a_file/0DESCRIPTION create mode 100644 Task/Delete_a_file/1META.yaml create mode 100644 Task/Delete_a_file/AWK/delete_a_file.awk create mode 100644 Task/Delete_a_file/BASIC/delete_a_file-2.bas create mode 100644 Task/Delete_a_file/BASIC/delete_a_file.bas create mode 100644 Task/Delete_a_file/C/delete_a_file-2.c create mode 100644 Task/Delete_a_file/C/delete_a_file.c create mode 100644 Task/Delete_a_file/Clojure/delete_a_file.clj create mode 100644 Task/Delete_a_file/Erlang/delete_a_file.erl create mode 100644 Task/Delete_a_file/Forth/delete_a_file.fth create mode 100644 Task/Delete_a_file/Fortran/delete_a_file.f create mode 100644 Task/Delete_a_file/Go/delete_a_file.go create mode 100644 Task/Delete_a_file/Haskell/delete_a_file.hs create mode 100644 Task/Delete_a_file/Java/delete_a_file.java create mode 100644 Task/Delete_a_file/JavaScript/delete_a_file-2.js create mode 100644 Task/Delete_a_file/JavaScript/delete_a_file.js create mode 100644 Task/Delete_a_file/Lua/delete_a_file.lua create mode 100644 Task/Delete_a_file/PHP/delete_a_file.php create mode 100644 Task/Delete_a_file/Perl/delete_a_file.pl create mode 100644 Task/Delete_a_file/PicoLisp/delete_a_file.l create mode 100644 Task/Delete_a_file/Python/delete_a_file-2.py create mode 100644 Task/Delete_a_file/Python/delete_a_file.py create mode 100644 Task/Delete_a_file/R/delete_a_file.r create mode 100644 Task/Delete_a_file/Ruby/delete_a_file.rb create mode 100644 Task/Delete_a_file/Scheme/delete_a_file.ss create mode 100644 Task/Delete_a_file/Smalltalk/delete_a_file.st create mode 100644 Task/Delete_a_file/Tcl/delete_a_file.tcl create mode 100644 Task/Detect_division_by_zero/0DESCRIPTION create mode 100644 Task/Detect_division_by_zero/C/detect_division_by_zero.c create mode 100644 Task/Detect_division_by_zero/Clojure/detect_division_by_zero.clj create mode 100644 Task/Detect_division_by_zero/Eiffel/detect_division_by_zero.e create mode 100644 Task/Detect_division_by_zero/Erlang/detect_division_by_zero.erl create mode 100644 Task/Detect_division_by_zero/Forth/detect_division_by_zero.fth create mode 100644 Task/Detect_division_by_zero/Go/detect_division_by_zero.go create mode 100644 Task/Detect_division_by_zero/Haskell/detect_division_by_zero.hs create mode 100644 Task/Detect_division_by_zero/Java/detect_division_by_zero-2.java create mode 100644 Task/Detect_division_by_zero/Java/detect_division_by_zero.java create mode 100644 Task/Detect_division_by_zero/JavaScript/detect_division_by_zero.js create mode 100644 Task/Detect_division_by_zero/Lua/detect_division_by_zero.lua create mode 100644 Task/Detect_division_by_zero/PHP/detect_division_by_zero-2.php create mode 100644 Task/Detect_division_by_zero/PHP/detect_division_by_zero.php create mode 100644 Task/Detect_division_by_zero/Perl/detect_division_by_zero.pl create mode 100644 Task/Detect_division_by_zero/PicoLisp/detect_division_by_zero.l create mode 100644 Task/Detect_division_by_zero/Python/detect_division_by_zero.py create mode 100644 Task/Detect_division_by_zero/R/detect_division_by_zero.r create mode 100644 Task/Detect_division_by_zero/REXX/detect_division_by_zero.rexx create mode 100644 Task/Detect_division_by_zero/Racket/detect_division_by_zero.rkt create mode 100644 Task/Detect_division_by_zero/Ruby/detect_division_by_zero-2.rb create mode 100644 Task/Detect_division_by_zero/Ruby/detect_division_by_zero-3.rb create mode 100644 Task/Detect_division_by_zero/Ruby/detect_division_by_zero-4.rb create mode 100644 Task/Detect_division_by_zero/Ruby/detect_division_by_zero.rb create mode 100644 Task/Detect_division_by_zero/Scala/detect_division_by_zero.scala create mode 100644 Task/Detect_division_by_zero/Smalltalk/detect_division_by_zero.st create mode 100644 Task/Detect_division_by_zero/Tcl/detect_division_by_zero-2.tcl create mode 100644 Task/Detect_division_by_zero/Tcl/detect_division_by_zero.tcl create mode 100644 Task/Determine_if_a_string_is_numeric/0DESCRIPTION create mode 100644 Task/Determine_if_a_string_is_numeric/1META.yaml create mode 100644 Task/Determine_if_a_string_is_numeric/AWK/determine_if_a_string_is_numeric.awk create mode 100644 Task/Determine_if_a_string_is_numeric/ActionScript/determine_if_a_string_is_numeric.as create mode 100644 Task/Determine_if_a_string_is_numeric/BASIC/determine_if_a_string_is_numeric.bas create mode 100644 Task/Determine_if_a_string_is_numeric/C/determine_if_a_string_is_numeric.c create mode 100644 Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric-2.clj create mode 100644 Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric.clj create mode 100644 Task/Determine_if_a_string_is_numeric/CoffeeScript/determine_if_a_string_is_numeric.coffee create mode 100644 Task/Determine_if_a_string_is_numeric/Erlang/determine_if_a_string_is_numeric.erl create mode 100644 Task/Determine_if_a_string_is_numeric/Forth/determine_if_a_string_is_numeric.fth create mode 100644 Task/Determine_if_a_string_is_numeric/Fortran/determine_if_a_string_is_numeric.f create mode 100644 Task/Determine_if_a_string_is_numeric/Go/determine_if_a_string_is_numeric.go create mode 100644 Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric-2.hs create mode 100644 Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric.hs create mode 100644 Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-2.java create mode 100644 Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-3.java create mode 100644 Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-4.java create mode 100644 Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-5.java create mode 100644 Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric.java create mode 100644 Task/Determine_if_a_string_is_numeric/JavaScript/determine_if_a_string_is_numeric.js create mode 100644 Task/Determine_if_a_string_is_numeric/Lua/determine_if_a_string_is_numeric.lua create mode 100644 Task/Determine_if_a_string_is_numeric/PHP/determine_if_a_string_is_numeric.php create mode 100644 Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-2.pl create mode 100644 Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-3.pl create mode 100644 Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric.pl create mode 100644 Task/Determine_if_a_string_is_numeric/PicoLisp/determine_if_a_string_is_numeric.l create mode 100644 Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-2.py create mode 100644 Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-3.py create mode 100644 Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-4.py create mode 100644 Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric.py create mode 100644 Task/Determine_if_a_string_is_numeric/R/determine_if_a_string_is_numeric.r create mode 100644 Task/Determine_if_a_string_is_numeric/REXX/determine_if_a_string_is_numeric.rexx create mode 100644 Task/Determine_if_a_string_is_numeric/Racket/determine_if_a_string_is_numeric.rkt create mode 100644 Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric-2.rb create mode 100644 Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric.rb create mode 100644 Task/Determine_if_a_string_is_numeric/Scala/determine_if_a_string_is_numeric.scala create mode 100644 Task/Determine_if_a_string_is_numeric/Scheme/determine_if_a_string_is_numeric.ss create mode 100644 Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-2.st create mode 100644 Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-3.st create mode 100644 Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric.st create mode 100644 Task/Determine_if_a_string_is_numeric/Tcl/determine_if_a_string_is_numeric.tcl create mode 100644 Task/Forest_fire/0DESCRIPTION create mode 100644 Task/Forest_fire/1META.yaml create mode 100644 Task/Forest_fire/C/forest_fire-2.c create mode 100644 Task/Forest_fire/C/forest_fire.c create mode 100644 Task/Forest_fire/Clojure/forest_fire.clj create mode 100644 Task/Forest_fire/Fortran/forest_fire-2.f create mode 100644 Task/Forest_fire/Fortran/forest_fire.f create mode 100644 Task/Forest_fire/Go/forest_fire.go create mode 100644 Task/Forest_fire/Haskell/forest_fire-2.hs create mode 100644 Task/Forest_fire/Haskell/forest_fire.hs create mode 100644 Task/Forest_fire/Java/forest_fire.java create mode 100644 Task/Forest_fire/JavaScript/forest_fire-2.js create mode 100644 Task/Forest_fire/JavaScript/forest_fire.js create mode 100644 Task/Forest_fire/Perl/forest_fire.pl create mode 100644 Task/Forest_fire/PicoLisp/forest_fire.l create mode 100644 Task/Forest_fire/Python/forest_fire.py create mode 100644 Task/Forest_fire/REXX/forest_fire.rexx create mode 100644 Task/Forest_fire/Racket/forest_fire.rkt create mode 100644 Task/Forest_fire/Ruby/forest_fire.rb create mode 100644 Task/Forest_fire/Sather/forest_fire.sa create mode 100644 Task/Forest_fire/Scala/forest_fire-2.scala create mode 100644 Task/Forest_fire/Scala/forest_fire.scala create mode 100644 Task/Forest_fire/Tcl/forest_fire.tcl diff --git a/Conf/task.yaml b/Conf/task.yaml index 39a158239f..9131a6cc26 100644 --- a/Conf/task.yaml +++ b/Conf/task.yaml @@ -1,10 +1,37 @@ 99 Bottles of Beer: {} +Ackermann function: {} Anagrams: {} +Arrays: {} +Assertions: {} +Balanced brackets: {} +Balanced ternary: {} +Best shuffle: {} +# Binary digits: {} +Binary search: {} +Binary strings: {} Bulls and cows: {} +Caesar cipher: {} +Calendar: {} +# Catalan numbers: {} +Check that file exists: {} +Checkpoint synchronization: {} +# Cholesky decomposition: {} +Classes: {} +Closest-pair problem: {} +Collections: {} +Color of a screen pixel: {} Comments: {} Death Star: {} +# Deepcopy: {} +Define a primitive data type: {} +Delegates: {} +Delete a file: {} +Detect division by zero: {} +Determine if a string is numeric: {} Entropy: {} +# Execute SNUSP: {} FizzBuzz: {} +Forest fire: {} Go Fish: {} # Happy numbers: {} Infinity: {} @@ -18,4 +45,3 @@ Pi: {} Quine: {} # ROT-13: {} Search a list: {} - diff --git a/Lang/AWK/Ackermann_function b/Lang/AWK/Ackermann_function new file mode 120000 index 0000000000..55eed1d530 --- /dev/null +++ b/Lang/AWK/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/AWK \ No newline at end of file diff --git a/Lang/AWK/Arrays b/Lang/AWK/Arrays new file mode 120000 index 0000000000..2eadcfdc6e --- /dev/null +++ b/Lang/AWK/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/AWK \ No newline at end of file diff --git a/Lang/AWK/Balanced_brackets b/Lang/AWK/Balanced_brackets new file mode 120000 index 0000000000..13c3b40370 --- /dev/null +++ b/Lang/AWK/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/AWK \ No newline at end of file diff --git a/Lang/AWK/Best_shuffle b/Lang/AWK/Best_shuffle new file mode 120000 index 0000000000..4fb4277329 --- /dev/null +++ b/Lang/AWK/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/AWK \ No newline at end of file diff --git a/Lang/AWK/Binary_digits b/Lang/AWK/Binary_digits new file mode 120000 index 0000000000..28b79beeb6 --- /dev/null +++ b/Lang/AWK/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/AWK \ No newline at end of file diff --git a/Lang/AWK/Binary_search b/Lang/AWK/Binary_search new file mode 120000 index 0000000000..279f2412b0 --- /dev/null +++ b/Lang/AWK/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/AWK \ No newline at end of file diff --git a/Lang/AWK/Caesar_cipher b/Lang/AWK/Caesar_cipher new file mode 120000 index 0000000000..7ec2ada08a --- /dev/null +++ b/Lang/AWK/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/AWK \ No newline at end of file diff --git a/Lang/AWK/Collections b/Lang/AWK/Collections new file mode 120000 index 0000000000..0047b4b361 --- /dev/null +++ b/Lang/AWK/Collections @@ -0,0 +1 @@ +../../Task/Collections/AWK \ No newline at end of file diff --git a/Lang/AWK/Delete_a_file b/Lang/AWK/Delete_a_file new file mode 120000 index 0000000000..ac5798e0dd --- /dev/null +++ b/Lang/AWK/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/AWK \ No newline at end of file diff --git a/Lang/AWK/Determine_if_a_string_is_numeric b/Lang/AWK/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..3f208588d6 --- /dev/null +++ b/Lang/AWK/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/AWK \ No newline at end of file diff --git a/Lang/ActionScript/Ackermann_function b/Lang/ActionScript/Ackermann_function new file mode 120000 index 0000000000..b8704994ec --- /dev/null +++ b/Lang/ActionScript/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Arrays b/Lang/ActionScript/Arrays new file mode 120000 index 0000000000..48b72307d7 --- /dev/null +++ b/Lang/ActionScript/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Classes b/Lang/ActionScript/Classes new file mode 120000 index 0000000000..44866193d0 --- /dev/null +++ b/Lang/ActionScript/Classes @@ -0,0 +1 @@ +../../Task/Classes/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Determine_if_a_string_is_numeric b/Lang/ActionScript/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..9da79a0f4c --- /dev/null +++ b/Lang/ActionScript/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/ActionScript \ No newline at end of file diff --git a/Lang/BASIC/Ackermann_function b/Lang/BASIC/Ackermann_function new file mode 120000 index 0000000000..477aea8c1b --- /dev/null +++ b/Lang/BASIC/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Arrays b/Lang/BASIC/Arrays new file mode 120000 index 0000000000..88cc61b4f2 --- /dev/null +++ b/Lang/BASIC/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Balanced_brackets b/Lang/BASIC/Balanced_brackets new file mode 120000 index 0000000000..313b2701f1 --- /dev/null +++ b/Lang/BASIC/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Binary_search b/Lang/BASIC/Binary_search new file mode 120000 index 0000000000..689d4a95fd --- /dev/null +++ b/Lang/BASIC/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Binary_strings b/Lang/BASIC/Binary_strings new file mode 120000 index 0000000000..7e784e118b --- /dev/null +++ b/Lang/BASIC/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Check_that_file_exists b/Lang/BASIC/Check_that_file_exists new file mode 120000 index 0000000000..f617ce13c2 --- /dev/null +++ b/Lang/BASIC/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Classes b/Lang/BASIC/Classes new file mode 120000 index 0000000000..58c9596498 --- /dev/null +++ b/Lang/BASIC/Classes @@ -0,0 +1 @@ +../../Task/Classes/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Color_of_a_screen_pixel b/Lang/BASIC/Color_of_a_screen_pixel new file mode 120000 index 0000000000..0a9b0db951 --- /dev/null +++ b/Lang/BASIC/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Delete_a_file b/Lang/BASIC/Delete_a_file new file mode 120000 index 0000000000..221816760a --- /dev/null +++ b/Lang/BASIC/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Determine_if_a_string_is_numeric b/Lang/BASIC/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..8e01d77fd1 --- /dev/null +++ b/Lang/BASIC/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/BASIC \ No newline at end of file diff --git a/Lang/Babel/Ackermann_function b/Lang/Babel/Ackermann_function new file mode 120000 index 0000000000..cf4a8d16d0 --- /dev/null +++ b/Lang/Babel/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Babel \ No newline at end of file diff --git a/Lang/Befunge/Ackermann_function b/Lang/Befunge/Ackermann_function new file mode 120000 index 0000000000..7239384a37 --- /dev/null +++ b/Lang/Befunge/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Befunge \ No newline at end of file diff --git a/Lang/Befunge/Balanced_brackets b/Lang/Befunge/Balanced_brackets new file mode 120000 index 0000000000..20a2e353a2 --- /dev/null +++ b/Lang/Befunge/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Befunge \ No newline at end of file diff --git a/Lang/C/Ackermann_function b/Lang/C/Ackermann_function new file mode 120000 index 0000000000..998425866f --- /dev/null +++ b/Lang/C/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/C \ No newline at end of file diff --git a/Lang/C/Arrays b/Lang/C/Arrays new file mode 120000 index 0000000000..dd729e35ad --- /dev/null +++ b/Lang/C/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/C \ No newline at end of file diff --git a/Lang/C/Assertions b/Lang/C/Assertions new file mode 120000 index 0000000000..fce6083a5c --- /dev/null +++ b/Lang/C/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/C \ No newline at end of file diff --git a/Lang/C/Balanced_brackets b/Lang/C/Balanced_brackets new file mode 120000 index 0000000000..460168d570 --- /dev/null +++ b/Lang/C/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/C \ No newline at end of file diff --git a/Lang/C/Best_shuffle b/Lang/C/Best_shuffle new file mode 120000 index 0000000000..a86bd93023 --- /dev/null +++ b/Lang/C/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/C \ No newline at end of file diff --git a/Lang/C/Binary_digits b/Lang/C/Binary_digits new file mode 120000 index 0000000000..53c2cf9dfa --- /dev/null +++ b/Lang/C/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/C \ No newline at end of file diff --git a/Lang/C/Binary_search b/Lang/C/Binary_search new file mode 120000 index 0000000000..2c5f068fd1 --- /dev/null +++ b/Lang/C/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/C \ No newline at end of file diff --git a/Lang/C/Binary_strings b/Lang/C/Binary_strings new file mode 120000 index 0000000000..eba892c430 --- /dev/null +++ b/Lang/C/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/C \ No newline at end of file diff --git a/Lang/C/Caesar_cipher b/Lang/C/Caesar_cipher new file mode 120000 index 0000000000..7d268f6914 --- /dev/null +++ b/Lang/C/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/C \ No newline at end of file diff --git a/Lang/C/Calendar b/Lang/C/Calendar new file mode 120000 index 0000000000..163ce44427 --- /dev/null +++ b/Lang/C/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/C \ No newline at end of file diff --git a/Lang/C/Check_that_file_exists b/Lang/C/Check_that_file_exists new file mode 120000 index 0000000000..9e80fb3a74 --- /dev/null +++ b/Lang/C/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/C \ No newline at end of file diff --git a/Lang/C/Checkpoint_synchronization b/Lang/C/Checkpoint_synchronization new file mode 120000 index 0000000000..0c38c99bf0 --- /dev/null +++ b/Lang/C/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/C \ No newline at end of file diff --git a/Lang/C/Classes b/Lang/C/Classes new file mode 120000 index 0000000000..4e54057d2a --- /dev/null +++ b/Lang/C/Classes @@ -0,0 +1 @@ +../../Task/Classes/C \ No newline at end of file diff --git a/Lang/C/Collections b/Lang/C/Collections new file mode 120000 index 0000000000..7704a5c209 --- /dev/null +++ b/Lang/C/Collections @@ -0,0 +1 @@ +../../Task/Collections/C \ No newline at end of file diff --git a/Lang/C/Color_of_a_screen_pixel b/Lang/C/Color_of_a_screen_pixel new file mode 120000 index 0000000000..2595a0fdea --- /dev/null +++ b/Lang/C/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/C \ No newline at end of file diff --git a/Lang/C/Delegates b/Lang/C/Delegates new file mode 120000 index 0000000000..5fd541cdde --- /dev/null +++ b/Lang/C/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/C \ No newline at end of file diff --git a/Lang/C/Delete_a_file b/Lang/C/Delete_a_file new file mode 120000 index 0000000000..98326c418c --- /dev/null +++ b/Lang/C/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/C \ No newline at end of file diff --git a/Lang/C/Detect_division_by_zero b/Lang/C/Detect_division_by_zero new file mode 120000 index 0000000000..9aaa0e1580 --- /dev/null +++ b/Lang/C/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/C \ No newline at end of file diff --git a/Lang/C/Determine_if_a_string_is_numeric b/Lang/C/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..027f0e3bd7 --- /dev/null +++ b/Lang/C/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/C \ No newline at end of file diff --git a/Lang/C/Forest_fire b/Lang/C/Forest_fire new file mode 120000 index 0000000000..62a7ed1570 --- /dev/null +++ b/Lang/C/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/C \ No newline at end of file diff --git a/Lang/Clojure/Ackermann_function b/Lang/Clojure/Ackermann_function new file mode 120000 index 0000000000..68bf60e28a --- /dev/null +++ b/Lang/Clojure/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Arrays b/Lang/Clojure/Arrays new file mode 120000 index 0000000000..94475e0568 --- /dev/null +++ b/Lang/Clojure/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Assertions b/Lang/Clojure/Assertions new file mode 120000 index 0000000000..8480c5e992 --- /dev/null +++ b/Lang/Clojure/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Balanced_brackets b/Lang/Clojure/Balanced_brackets new file mode 120000 index 0000000000..c4633b2bcf --- /dev/null +++ b/Lang/Clojure/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Best_shuffle b/Lang/Clojure/Best_shuffle new file mode 120000 index 0000000000..31188ea1f0 --- /dev/null +++ b/Lang/Clojure/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Binary_digits b/Lang/Clojure/Binary_digits new file mode 120000 index 0000000000..c3abb756b7 --- /dev/null +++ b/Lang/Clojure/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Binary_search b/Lang/Clojure/Binary_search new file mode 120000 index 0000000000..0f05458a0f --- /dev/null +++ b/Lang/Clojure/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Caesar_cipher b/Lang/Clojure/Caesar_cipher new file mode 120000 index 0000000000..90245c6bbd --- /dev/null +++ b/Lang/Clojure/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Check_that_file_exists b/Lang/Clojure/Check_that_file_exists new file mode 120000 index 0000000000..9e3c5ce048 --- /dev/null +++ b/Lang/Clojure/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Closest-pair_problem b/Lang/Clojure/Closest-pair_problem new file mode 120000 index 0000000000..4073508d3f --- /dev/null +++ b/Lang/Clojure/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Collections b/Lang/Clojure/Collections new file mode 120000 index 0000000000..1a8636abfb --- /dev/null +++ b/Lang/Clojure/Collections @@ -0,0 +1 @@ +../../Task/Collections/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Color_of_a_screen_pixel b/Lang/Clojure/Color_of_a_screen_pixel new file mode 120000 index 0000000000..4b90d99ab4 --- /dev/null +++ b/Lang/Clojure/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Delete_a_file b/Lang/Clojure/Delete_a_file new file mode 120000 index 0000000000..222e9a6448 --- /dev/null +++ b/Lang/Clojure/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Detect_division_by_zero b/Lang/Clojure/Detect_division_by_zero new file mode 120000 index 0000000000..9fb0dbb5a9 --- /dev/null +++ b/Lang/Clojure/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Determine_if_a_string_is_numeric b/Lang/Clojure/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..6a0fa808dc --- /dev/null +++ b/Lang/Clojure/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Forest_fire b/Lang/Clojure/Forest_fire new file mode 120000 index 0000000000..2df94a59f5 --- /dev/null +++ b/Lang/Clojure/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Clojure \ No newline at end of file diff --git a/Lang/CoffeeScript/Ackermann_function b/Lang/CoffeeScript/Ackermann_function new file mode 120000 index 0000000000..12204c8b0b --- /dev/null +++ b/Lang/CoffeeScript/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Arrays b/Lang/CoffeeScript/Arrays new file mode 120000 index 0000000000..704bce0590 --- /dev/null +++ b/Lang/CoffeeScript/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Balanced_brackets b/Lang/CoffeeScript/Balanced_brackets new file mode 120000 index 0000000000..334afd9152 --- /dev/null +++ b/Lang/CoffeeScript/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Binary_digits b/Lang/CoffeeScript/Binary_digits new file mode 120000 index 0000000000..4f0bc3791e --- /dev/null +++ b/Lang/CoffeeScript/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Binary_search b/Lang/CoffeeScript/Binary_search new file mode 120000 index 0000000000..9e7770d852 --- /dev/null +++ b/Lang/CoffeeScript/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Caesar_cipher b/Lang/CoffeeScript/Caesar_cipher new file mode 120000 index 0000000000..ffcdcaffac --- /dev/null +++ b/Lang/CoffeeScript/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Classes b/Lang/CoffeeScript/Classes new file mode 120000 index 0000000000..bafef668c0 --- /dev/null +++ b/Lang/CoffeeScript/Classes @@ -0,0 +1 @@ +../../Task/Classes/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Delegates b/Lang/CoffeeScript/Delegates new file mode 120000 index 0000000000..2a7e10777c --- /dev/null +++ b/Lang/CoffeeScript/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Determine_if_a_string_is_numeric b/Lang/CoffeeScript/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..bc21082891 --- /dev/null +++ b/Lang/CoffeeScript/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/CoffeeScript \ No newline at end of file diff --git a/Lang/Dylan/Ackermann_function b/Lang/Dylan/Ackermann_function new file mode 120000 index 0000000000..45a16a054c --- /dev/null +++ b/Lang/Dylan/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Dylan \ No newline at end of file diff --git a/Lang/Eiffel/Ackermann_function b/Lang/Eiffel/Ackermann_function new file mode 120000 index 0000000000..2d013c9aef --- /dev/null +++ b/Lang/Eiffel/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Eiffel \ No newline at end of file diff --git a/Lang/Eiffel/Arrays b/Lang/Eiffel/Arrays new file mode 120000 index 0000000000..6e67e31ae0 --- /dev/null +++ b/Lang/Eiffel/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Eiffel \ No newline at end of file diff --git a/Lang/Eiffel/Assertions b/Lang/Eiffel/Assertions new file mode 120000 index 0000000000..300589f793 --- /dev/null +++ b/Lang/Eiffel/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Eiffel \ No newline at end of file diff --git a/Lang/Eiffel/Detect_division_by_zero b/Lang/Eiffel/Detect_division_by_zero new file mode 120000 index 0000000000..5acedfb1b7 --- /dev/null +++ b/Lang/Eiffel/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Eiffel \ No newline at end of file diff --git a/Lang/Erlang/Ackermann_function b/Lang/Erlang/Ackermann_function new file mode 120000 index 0000000000..79b94fba17 --- /dev/null +++ b/Lang/Erlang/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Arrays b/Lang/Erlang/Arrays new file mode 120000 index 0000000000..0f830c6ee3 --- /dev/null +++ b/Lang/Erlang/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Assertions b/Lang/Erlang/Assertions new file mode 120000 index 0000000000..a4a2a9b52d --- /dev/null +++ b/Lang/Erlang/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Balanced_ternary b/Lang/Erlang/Balanced_ternary new file mode 120000 index 0000000000..b80ca83802 --- /dev/null +++ b/Lang/Erlang/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Binary_digits b/Lang/Erlang/Binary_digits new file mode 120000 index 0000000000..8f2b978e61 --- /dev/null +++ b/Lang/Erlang/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Binary_search b/Lang/Erlang/Binary_search new file mode 120000 index 0000000000..74707556b7 --- /dev/null +++ b/Lang/Erlang/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Caesar_cipher b/Lang/Erlang/Caesar_cipher new file mode 120000 index 0000000000..3b0cdc9c9e --- /dev/null +++ b/Lang/Erlang/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Check_that_file_exists b/Lang/Erlang/Check_that_file_exists new file mode 120000 index 0000000000..9b6aa8e20a --- /dev/null +++ b/Lang/Erlang/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Delete_a_file b/Lang/Erlang/Delete_a_file new file mode 120000 index 0000000000..7ed65f4394 --- /dev/null +++ b/Lang/Erlang/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Detect_division_by_zero b/Lang/Erlang/Detect_division_by_zero new file mode 120000 index 0000000000..6385297e31 --- /dev/null +++ b/Lang/Erlang/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Determine_if_a_string_is_numeric b/Lang/Erlang/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..69f84afb47 --- /dev/null +++ b/Lang/Erlang/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Erlang \ No newline at end of file diff --git a/Lang/Forth/Ackermann_function b/Lang/Forth/Ackermann_function new file mode 120000 index 0000000000..a40810d418 --- /dev/null +++ b/Lang/Forth/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Forth \ No newline at end of file diff --git a/Lang/Forth/Arrays b/Lang/Forth/Arrays new file mode 120000 index 0000000000..8623c6454d --- /dev/null +++ b/Lang/Forth/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Forth \ No newline at end of file diff --git a/Lang/Forth/Balanced_brackets b/Lang/Forth/Balanced_brackets new file mode 120000 index 0000000000..5630c710cb --- /dev/null +++ b/Lang/Forth/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Forth \ No newline at end of file diff --git a/Lang/Forth/Binary_digits b/Lang/Forth/Binary_digits new file mode 120000 index 0000000000..2ce1c4e2dc --- /dev/null +++ b/Lang/Forth/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Forth \ No newline at end of file diff --git a/Lang/Forth/Binary_search b/Lang/Forth/Binary_search new file mode 120000 index 0000000000..314bb363f6 --- /dev/null +++ b/Lang/Forth/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Forth \ No newline at end of file diff --git a/Lang/Forth/Binary_strings b/Lang/Forth/Binary_strings new file mode 120000 index 0000000000..7d07a67423 --- /dev/null +++ b/Lang/Forth/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Forth \ No newline at end of file diff --git a/Lang/Forth/Caesar_cipher b/Lang/Forth/Caesar_cipher new file mode 120000 index 0000000000..292ae94db6 --- /dev/null +++ b/Lang/Forth/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Forth \ No newline at end of file diff --git a/Lang/Forth/Check_that_file_exists b/Lang/Forth/Check_that_file_exists new file mode 120000 index 0000000000..ccb4a78339 --- /dev/null +++ b/Lang/Forth/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Forth \ No newline at end of file diff --git a/Lang/Forth/Classes b/Lang/Forth/Classes new file mode 120000 index 0000000000..e75a68641f --- /dev/null +++ b/Lang/Forth/Classes @@ -0,0 +1 @@ +../../Task/Classes/Forth \ No newline at end of file diff --git a/Lang/Forth/Collections b/Lang/Forth/Collections new file mode 120000 index 0000000000..6c1b36130a --- /dev/null +++ b/Lang/Forth/Collections @@ -0,0 +1 @@ +../../Task/Collections/Forth \ No newline at end of file diff --git a/Lang/Forth/Delete_a_file b/Lang/Forth/Delete_a_file new file mode 120000 index 0000000000..cfb2024c3b --- /dev/null +++ b/Lang/Forth/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Forth \ No newline at end of file diff --git a/Lang/Forth/Detect_division_by_zero b/Lang/Forth/Detect_division_by_zero new file mode 120000 index 0000000000..7e42c34ad7 --- /dev/null +++ b/Lang/Forth/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Forth \ No newline at end of file diff --git a/Lang/Forth/Determine_if_a_string_is_numeric b/Lang/Forth/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..fd0cfec303 --- /dev/null +++ b/Lang/Forth/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Forth \ No newline at end of file diff --git a/Lang/Fortran/Ackermann_function b/Lang/Fortran/Ackermann_function new file mode 120000 index 0000000000..36dae59f11 --- /dev/null +++ b/Lang/Fortran/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Arrays b/Lang/Fortran/Arrays new file mode 120000 index 0000000000..95509755b7 --- /dev/null +++ b/Lang/Fortran/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Binary_search b/Lang/Fortran/Binary_search new file mode 120000 index 0000000000..2250a9848c --- /dev/null +++ b/Lang/Fortran/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Caesar_cipher b/Lang/Fortran/Caesar_cipher new file mode 120000 index 0000000000..dcc3b4412f --- /dev/null +++ b/Lang/Fortran/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Check_that_file_exists b/Lang/Fortran/Check_that_file_exists new file mode 120000 index 0000000000..44664b7435 --- /dev/null +++ b/Lang/Fortran/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Define_a_primitive_data_type b/Lang/Fortran/Define_a_primitive_data_type new file mode 120000 index 0000000000..cb50a81409 --- /dev/null +++ b/Lang/Fortran/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Delete_a_file b/Lang/Fortran/Delete_a_file new file mode 120000 index 0000000000..837624de17 --- /dev/null +++ b/Lang/Fortran/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Determine_if_a_string_is_numeric b/Lang/Fortran/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..a3693e4f2a --- /dev/null +++ b/Lang/Fortran/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Forest_fire b/Lang/Fortran/Forest_fire new file mode 120000 index 0000000000..953988e03e --- /dev/null +++ b/Lang/Fortran/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Fortran \ No newline at end of file diff --git a/Lang/Go/Ackermann_function b/Lang/Go/Ackermann_function new file mode 120000 index 0000000000..88772aa172 --- /dev/null +++ b/Lang/Go/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Go \ No newline at end of file diff --git a/Lang/Go/Arrays b/Lang/Go/Arrays new file mode 120000 index 0000000000..4daef75d31 --- /dev/null +++ b/Lang/Go/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Go \ No newline at end of file diff --git a/Lang/Go/Assertions b/Lang/Go/Assertions new file mode 120000 index 0000000000..1164df1b0d --- /dev/null +++ b/Lang/Go/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Go \ No newline at end of file diff --git a/Lang/Go/Balanced_brackets b/Lang/Go/Balanced_brackets new file mode 120000 index 0000000000..dc661eb80c --- /dev/null +++ b/Lang/Go/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Go \ No newline at end of file diff --git a/Lang/Go/Balanced_ternary b/Lang/Go/Balanced_ternary new file mode 120000 index 0000000000..b7dd2556fb --- /dev/null +++ b/Lang/Go/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Go \ No newline at end of file diff --git a/Lang/Go/Best_shuffle b/Lang/Go/Best_shuffle new file mode 120000 index 0000000000..55d15131a1 --- /dev/null +++ b/Lang/Go/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Go \ No newline at end of file diff --git a/Lang/Go/Binary_digits b/Lang/Go/Binary_digits new file mode 120000 index 0000000000..94aaa0ee60 --- /dev/null +++ b/Lang/Go/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Go \ No newline at end of file diff --git a/Lang/Go/Binary_search b/Lang/Go/Binary_search new file mode 120000 index 0000000000..a54e2f3abc --- /dev/null +++ b/Lang/Go/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Go \ No newline at end of file diff --git a/Lang/Go/Binary_strings b/Lang/Go/Binary_strings new file mode 120000 index 0000000000..09f7e9c7b2 --- /dev/null +++ b/Lang/Go/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Go \ No newline at end of file diff --git a/Lang/Go/Caesar_cipher b/Lang/Go/Caesar_cipher new file mode 120000 index 0000000000..9accfa04e8 --- /dev/null +++ b/Lang/Go/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Go \ No newline at end of file diff --git a/Lang/Go/Check_that_file_exists b/Lang/Go/Check_that_file_exists new file mode 120000 index 0000000000..d40b9a3f80 --- /dev/null +++ b/Lang/Go/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Go \ No newline at end of file diff --git a/Lang/Go/Checkpoint_synchronization b/Lang/Go/Checkpoint_synchronization new file mode 120000 index 0000000000..696c346836 --- /dev/null +++ b/Lang/Go/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Go \ No newline at end of file diff --git a/Lang/Go/Classes b/Lang/Go/Classes new file mode 120000 index 0000000000..ea41a7e128 --- /dev/null +++ b/Lang/Go/Classes @@ -0,0 +1 @@ +../../Task/Classes/Go \ No newline at end of file diff --git a/Lang/Go/Closest-pair_problem b/Lang/Go/Closest-pair_problem new file mode 120000 index 0000000000..3ab051d563 --- /dev/null +++ b/Lang/Go/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Go \ No newline at end of file diff --git a/Lang/Go/Collections b/Lang/Go/Collections new file mode 120000 index 0000000000..e588b60daa --- /dev/null +++ b/Lang/Go/Collections @@ -0,0 +1 @@ +../../Task/Collections/Go \ No newline at end of file diff --git a/Lang/Go/Deepcopy b/Lang/Go/Deepcopy new file mode 120000 index 0000000000..a7a6c1ed9e --- /dev/null +++ b/Lang/Go/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Go \ No newline at end of file diff --git a/Lang/Go/Delegates b/Lang/Go/Delegates new file mode 120000 index 0000000000..8f7dab7157 --- /dev/null +++ b/Lang/Go/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Go \ No newline at end of file diff --git a/Lang/Go/Delete_a_file b/Lang/Go/Delete_a_file new file mode 120000 index 0000000000..ffa7b0f687 --- /dev/null +++ b/Lang/Go/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Go \ No newline at end of file diff --git a/Lang/Go/Detect_division_by_zero b/Lang/Go/Detect_division_by_zero new file mode 120000 index 0000000000..faf39b5bf2 --- /dev/null +++ b/Lang/Go/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Go \ No newline at end of file diff --git a/Lang/Go/Determine_if_a_string_is_numeric b/Lang/Go/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..e5561d5c84 --- /dev/null +++ b/Lang/Go/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Go \ No newline at end of file diff --git a/Lang/Go/Forest_fire b/Lang/Go/Forest_fire new file mode 120000 index 0000000000..e080935a1f --- /dev/null +++ b/Lang/Go/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Go \ No newline at end of file diff --git a/Lang/Haskell/Ackermann_function b/Lang/Haskell/Ackermann_function new file mode 120000 index 0000000000..e12ec767c1 --- /dev/null +++ b/Lang/Haskell/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Arrays b/Lang/Haskell/Arrays new file mode 120000 index 0000000000..6b3b55f01e --- /dev/null +++ b/Lang/Haskell/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Assertions b/Lang/Haskell/Assertions new file mode 120000 index 0000000000..5e719f002e --- /dev/null +++ b/Lang/Haskell/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Balanced_brackets b/Lang/Haskell/Balanced_brackets new file mode 120000 index 0000000000..51c8672c7e --- /dev/null +++ b/Lang/Haskell/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Balanced_ternary b/Lang/Haskell/Balanced_ternary new file mode 120000 index 0000000000..5e13dbe529 --- /dev/null +++ b/Lang/Haskell/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Best_shuffle b/Lang/Haskell/Best_shuffle new file mode 120000 index 0000000000..3814094e30 --- /dev/null +++ b/Lang/Haskell/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Binary_digits b/Lang/Haskell/Binary_digits new file mode 120000 index 0000000000..fdf5312f0e --- /dev/null +++ b/Lang/Haskell/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Binary_search b/Lang/Haskell/Binary_search new file mode 120000 index 0000000000..7bf4e24215 --- /dev/null +++ b/Lang/Haskell/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Binary_strings b/Lang/Haskell/Binary_strings new file mode 120000 index 0000000000..a6c676ca8a --- /dev/null +++ b/Lang/Haskell/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Caesar_cipher b/Lang/Haskell/Caesar_cipher new file mode 120000 index 0000000000..e54f072898 --- /dev/null +++ b/Lang/Haskell/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Check_that_file_exists b/Lang/Haskell/Check_that_file_exists new file mode 120000 index 0000000000..9139d3056e --- /dev/null +++ b/Lang/Haskell/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Checkpoint_synchronization b/Lang/Haskell/Checkpoint_synchronization new file mode 120000 index 0000000000..ef409bebab --- /dev/null +++ b/Lang/Haskell/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Classes b/Lang/Haskell/Classes new file mode 120000 index 0000000000..bc84298343 --- /dev/null +++ b/Lang/Haskell/Classes @@ -0,0 +1 @@ +../../Task/Classes/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Closest-pair_problem b/Lang/Haskell/Closest-pair_problem new file mode 120000 index 0000000000..4f2494478c --- /dev/null +++ b/Lang/Haskell/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Collections b/Lang/Haskell/Collections new file mode 120000 index 0000000000..cf2742e730 --- /dev/null +++ b/Lang/Haskell/Collections @@ -0,0 +1 @@ +../../Task/Collections/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Define_a_primitive_data_type b/Lang/Haskell/Define_a_primitive_data_type new file mode 120000 index 0000000000..b065d2e081 --- /dev/null +++ b/Lang/Haskell/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Delete_a_file b/Lang/Haskell/Delete_a_file new file mode 120000 index 0000000000..5c9424e084 --- /dev/null +++ b/Lang/Haskell/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Detect_division_by_zero b/Lang/Haskell/Detect_division_by_zero new file mode 120000 index 0000000000..9c4433e791 --- /dev/null +++ b/Lang/Haskell/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Determine_if_a_string_is_numeric b/Lang/Haskell/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..b7eb3c9281 --- /dev/null +++ b/Lang/Haskell/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Forest_fire b/Lang/Haskell/Forest_fire new file mode 120000 index 0000000000..680e6d0643 --- /dev/null +++ b/Lang/Haskell/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Haskell \ No newline at end of file diff --git a/Lang/Java/Ackermann_function b/Lang/Java/Ackermann_function new file mode 120000 index 0000000000..a3b169ea0b --- /dev/null +++ b/Lang/Java/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Java \ No newline at end of file diff --git a/Lang/Java/Arrays b/Lang/Java/Arrays new file mode 120000 index 0000000000..b44c1fd5b7 --- /dev/null +++ b/Lang/Java/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Java \ No newline at end of file diff --git a/Lang/Java/Assertions b/Lang/Java/Assertions new file mode 120000 index 0000000000..36031b7931 --- /dev/null +++ b/Lang/Java/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Java \ No newline at end of file diff --git a/Lang/Java/Balanced_brackets b/Lang/Java/Balanced_brackets new file mode 120000 index 0000000000..afbfbf21c0 --- /dev/null +++ b/Lang/Java/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Java \ No newline at end of file diff --git a/Lang/Java/Best_shuffle b/Lang/Java/Best_shuffle new file mode 120000 index 0000000000..955b900d1c --- /dev/null +++ b/Lang/Java/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Java \ No newline at end of file diff --git a/Lang/Java/Binary_digits b/Lang/Java/Binary_digits new file mode 120000 index 0000000000..c668d6c73c --- /dev/null +++ b/Lang/Java/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Java \ No newline at end of file diff --git a/Lang/Java/Binary_search b/Lang/Java/Binary_search new file mode 120000 index 0000000000..5798d3eb9c --- /dev/null +++ b/Lang/Java/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Java \ No newline at end of file diff --git a/Lang/Java/Caesar_cipher b/Lang/Java/Caesar_cipher new file mode 120000 index 0000000000..1666520377 --- /dev/null +++ b/Lang/Java/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Java \ No newline at end of file diff --git a/Lang/Java/Check_that_file_exists b/Lang/Java/Check_that_file_exists new file mode 120000 index 0000000000..c2dd445606 --- /dev/null +++ b/Lang/Java/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Java \ No newline at end of file diff --git a/Lang/Java/Checkpoint_synchronization b/Lang/Java/Checkpoint_synchronization new file mode 120000 index 0000000000..72896adf90 --- /dev/null +++ b/Lang/Java/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Java \ No newline at end of file diff --git a/Lang/Java/Classes b/Lang/Java/Classes new file mode 120000 index 0000000000..0d95cfe341 --- /dev/null +++ b/Lang/Java/Classes @@ -0,0 +1 @@ +../../Task/Classes/Java \ No newline at end of file diff --git a/Lang/Java/Closest-pair_problem b/Lang/Java/Closest-pair_problem new file mode 120000 index 0000000000..334887cdef --- /dev/null +++ b/Lang/Java/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Java \ No newline at end of file diff --git a/Lang/Java/Collections b/Lang/Java/Collections new file mode 120000 index 0000000000..0f58645a27 --- /dev/null +++ b/Lang/Java/Collections @@ -0,0 +1 @@ +../../Task/Collections/Java \ No newline at end of file diff --git a/Lang/Java/Color_of_a_screen_pixel b/Lang/Java/Color_of_a_screen_pixel new file mode 120000 index 0000000000..4a57e960fd --- /dev/null +++ b/Lang/Java/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/Java \ No newline at end of file diff --git a/Lang/Java/Define_a_primitive_data_type b/Lang/Java/Define_a_primitive_data_type new file mode 120000 index 0000000000..4d198e22e1 --- /dev/null +++ b/Lang/Java/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Java \ No newline at end of file diff --git a/Lang/Java/Delegates b/Lang/Java/Delegates new file mode 120000 index 0000000000..081f8f0f80 --- /dev/null +++ b/Lang/Java/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Java \ No newline at end of file diff --git a/Lang/Java/Delete_a_file b/Lang/Java/Delete_a_file new file mode 120000 index 0000000000..513c6f8add --- /dev/null +++ b/Lang/Java/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Java \ No newline at end of file diff --git a/Lang/Java/Detect_division_by_zero b/Lang/Java/Detect_division_by_zero new file mode 120000 index 0000000000..1b4975ef4e --- /dev/null +++ b/Lang/Java/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Java \ No newline at end of file diff --git a/Lang/Java/Determine_if_a_string_is_numeric b/Lang/Java/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..45041bf8ad --- /dev/null +++ b/Lang/Java/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Java \ No newline at end of file diff --git a/Lang/Java/Forest_fire b/Lang/Java/Forest_fire new file mode 120000 index 0000000000..2a3cc771ca --- /dev/null +++ b/Lang/Java/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Java \ No newline at end of file diff --git a/Lang/JavaScript/Ackermann_function b/Lang/JavaScript/Ackermann_function new file mode 120000 index 0000000000..c1f1d4abe0 --- /dev/null +++ b/Lang/JavaScript/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Arrays b/Lang/JavaScript/Arrays new file mode 120000 index 0000000000..ffe1f3df6d --- /dev/null +++ b/Lang/JavaScript/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Balanced_brackets b/Lang/JavaScript/Balanced_brackets new file mode 120000 index 0000000000..80c2037b5e --- /dev/null +++ b/Lang/JavaScript/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Best_shuffle b/Lang/JavaScript/Best_shuffle new file mode 120000 index 0000000000..b33d30cfbe --- /dev/null +++ b/Lang/JavaScript/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Binary_digits b/Lang/JavaScript/Binary_digits new file mode 120000 index 0000000000..da3369464f --- /dev/null +++ b/Lang/JavaScript/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Binary_search b/Lang/JavaScript/Binary_search new file mode 120000 index 0000000000..afce2fc614 --- /dev/null +++ b/Lang/JavaScript/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Caesar_cipher b/Lang/JavaScript/Caesar_cipher new file mode 120000 index 0000000000..87594e40f8 --- /dev/null +++ b/Lang/JavaScript/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Check_that_file_exists b/Lang/JavaScript/Check_that_file_exists new file mode 120000 index 0000000000..66bde4f07a --- /dev/null +++ b/Lang/JavaScript/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Classes b/Lang/JavaScript/Classes new file mode 120000 index 0000000000..068333dc14 --- /dev/null +++ b/Lang/JavaScript/Classes @@ -0,0 +1 @@ +../../Task/Classes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Closest-pair_problem b/Lang/JavaScript/Closest-pair_problem new file mode 120000 index 0000000000..f9fcef2807 --- /dev/null +++ b/Lang/JavaScript/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Collections b/Lang/JavaScript/Collections new file mode 120000 index 0000000000..4f096cf2cf --- /dev/null +++ b/Lang/JavaScript/Collections @@ -0,0 +1 @@ +../../Task/Collections/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Deepcopy b/Lang/JavaScript/Deepcopy new file mode 120000 index 0000000000..47197fe6cb --- /dev/null +++ b/Lang/JavaScript/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Define_a_primitive_data_type b/Lang/JavaScript/Define_a_primitive_data_type new file mode 120000 index 0000000000..850a10c90f --- /dev/null +++ b/Lang/JavaScript/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Delegates b/Lang/JavaScript/Delegates new file mode 120000 index 0000000000..5ec22f6593 --- /dev/null +++ b/Lang/JavaScript/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Delete_a_file b/Lang/JavaScript/Delete_a_file new file mode 120000 index 0000000000..ee865bb4bf --- /dev/null +++ b/Lang/JavaScript/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Detect_division_by_zero b/Lang/JavaScript/Detect_division_by_zero new file mode 120000 index 0000000000..b3e15499b2 --- /dev/null +++ b/Lang/JavaScript/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Determine_if_a_string_is_numeric b/Lang/JavaScript/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..015cea4bef --- /dev/null +++ b/Lang/JavaScript/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Forest_fire b/Lang/JavaScript/Forest_fire new file mode 120000 index 0000000000..44115e9b51 --- /dev/null +++ b/Lang/JavaScript/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/JavaScript \ No newline at end of file diff --git a/Lang/Lua/Ackermann_function b/Lang/Lua/Ackermann_function new file mode 120000 index 0000000000..08cde75296 --- /dev/null +++ b/Lang/Lua/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Lua \ No newline at end of file diff --git a/Lang/Lua/Arrays b/Lang/Lua/Arrays new file mode 120000 index 0000000000..275affec5d --- /dev/null +++ b/Lang/Lua/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Lua \ No newline at end of file diff --git a/Lang/Lua/Assertions b/Lang/Lua/Assertions new file mode 120000 index 0000000000..598716d157 --- /dev/null +++ b/Lang/Lua/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Lua \ No newline at end of file diff --git a/Lang/Lua/Balanced_brackets b/Lang/Lua/Balanced_brackets new file mode 120000 index 0000000000..8ad03e4d5b --- /dev/null +++ b/Lang/Lua/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Lua \ No newline at end of file diff --git a/Lang/Lua/Binary_search b/Lang/Lua/Binary_search new file mode 120000 index 0000000000..55c8713c4d --- /dev/null +++ b/Lang/Lua/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Lua \ No newline at end of file diff --git a/Lang/Lua/Binary_strings b/Lang/Lua/Binary_strings new file mode 120000 index 0000000000..b0e8073f89 --- /dev/null +++ b/Lang/Lua/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Lua \ No newline at end of file diff --git a/Lang/Lua/Caesar_cipher b/Lang/Lua/Caesar_cipher new file mode 120000 index 0000000000..eb23b2cf1b --- /dev/null +++ b/Lang/Lua/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Lua \ No newline at end of file diff --git a/Lang/Lua/Check_that_file_exists b/Lang/Lua/Check_that_file_exists new file mode 120000 index 0000000000..88b119cae9 --- /dev/null +++ b/Lang/Lua/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Lua \ No newline at end of file diff --git a/Lang/Lua/Classes b/Lang/Lua/Classes new file mode 120000 index 0000000000..1c4bfcf464 --- /dev/null +++ b/Lang/Lua/Classes @@ -0,0 +1 @@ +../../Task/Classes/Lua \ No newline at end of file diff --git a/Lang/Lua/Collections b/Lang/Lua/Collections new file mode 120000 index 0000000000..a4cc096c6b --- /dev/null +++ b/Lang/Lua/Collections @@ -0,0 +1 @@ +../../Task/Collections/Lua \ No newline at end of file diff --git a/Lang/Lua/Delete_a_file b/Lang/Lua/Delete_a_file new file mode 120000 index 0000000000..1a7555de26 --- /dev/null +++ b/Lang/Lua/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Lua \ No newline at end of file diff --git a/Lang/Lua/Detect_division_by_zero b/Lang/Lua/Detect_division_by_zero new file mode 120000 index 0000000000..56750fd0af --- /dev/null +++ b/Lang/Lua/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Lua \ No newline at end of file diff --git a/Lang/Lua/Determine_if_a_string_is_numeric b/Lang/Lua/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..0c528afe48 --- /dev/null +++ b/Lang/Lua/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Lua \ No newline at end of file diff --git a/Lang/PHP/Ackermann_function b/Lang/PHP/Ackermann_function new file mode 120000 index 0000000000..27eec70953 --- /dev/null +++ b/Lang/PHP/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/PHP \ No newline at end of file diff --git a/Lang/PHP/Arrays b/Lang/PHP/Arrays new file mode 120000 index 0000000000..b1bab42ad2 --- /dev/null +++ b/Lang/PHP/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/PHP \ No newline at end of file diff --git a/Lang/PHP/Assertions b/Lang/PHP/Assertions new file mode 120000 index 0000000000..d2d70a71bf --- /dev/null +++ b/Lang/PHP/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/PHP \ No newline at end of file diff --git a/Lang/PHP/Best_shuffle b/Lang/PHP/Best_shuffle new file mode 120000 index 0000000000..b0dd73cd82 --- /dev/null +++ b/Lang/PHP/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/PHP \ No newline at end of file diff --git a/Lang/PHP/Binary_digits b/Lang/PHP/Binary_digits new file mode 120000 index 0000000000..bf9973bf27 --- /dev/null +++ b/Lang/PHP/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/PHP \ No newline at end of file diff --git a/Lang/PHP/Binary_search b/Lang/PHP/Binary_search new file mode 120000 index 0000000000..3a855d2db9 --- /dev/null +++ b/Lang/PHP/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/PHP \ No newline at end of file diff --git a/Lang/PHP/Caesar_cipher b/Lang/PHP/Caesar_cipher new file mode 120000 index 0000000000..747e0f4ce5 --- /dev/null +++ b/Lang/PHP/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/PHP \ No newline at end of file diff --git a/Lang/PHP/Check_that_file_exists b/Lang/PHP/Check_that_file_exists new file mode 120000 index 0000000000..e8199401c2 --- /dev/null +++ b/Lang/PHP/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/PHP \ No newline at end of file diff --git a/Lang/PHP/Classes b/Lang/PHP/Classes new file mode 120000 index 0000000000..90dd617d1d --- /dev/null +++ b/Lang/PHP/Classes @@ -0,0 +1 @@ +../../Task/Classes/PHP \ No newline at end of file diff --git a/Lang/PHP/Collections b/Lang/PHP/Collections new file mode 120000 index 0000000000..f77bacf11c --- /dev/null +++ b/Lang/PHP/Collections @@ -0,0 +1 @@ +../../Task/Collections/PHP \ No newline at end of file diff --git a/Lang/PHP/Color_of_a_screen_pixel b/Lang/PHP/Color_of_a_screen_pixel new file mode 120000 index 0000000000..2e31d3f977 --- /dev/null +++ b/Lang/PHP/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/PHP \ No newline at end of file diff --git a/Lang/PHP/Delegates b/Lang/PHP/Delegates new file mode 120000 index 0000000000..d5ce09bfb5 --- /dev/null +++ b/Lang/PHP/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/PHP \ No newline at end of file diff --git a/Lang/PHP/Delete_a_file b/Lang/PHP/Delete_a_file new file mode 120000 index 0000000000..e97977e63a --- /dev/null +++ b/Lang/PHP/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/PHP \ No newline at end of file diff --git a/Lang/PHP/Detect_division_by_zero b/Lang/PHP/Detect_division_by_zero new file mode 120000 index 0000000000..8bee6657e8 --- /dev/null +++ b/Lang/PHP/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/PHP \ No newline at end of file diff --git a/Lang/PHP/Determine_if_a_string_is_numeric b/Lang/PHP/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..4498ea1ae4 --- /dev/null +++ b/Lang/PHP/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/PHP \ No newline at end of file diff --git a/Lang/Perl/Ackermann_function b/Lang/Perl/Ackermann_function new file mode 120000 index 0000000000..e459090249 --- /dev/null +++ b/Lang/Perl/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Perl \ No newline at end of file diff --git a/Lang/Perl/Arrays b/Lang/Perl/Arrays new file mode 120000 index 0000000000..5c9c2d6ac6 --- /dev/null +++ b/Lang/Perl/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Perl \ No newline at end of file diff --git a/Lang/Perl/Assertions b/Lang/Perl/Assertions new file mode 120000 index 0000000000..421c2c4783 --- /dev/null +++ b/Lang/Perl/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Perl \ No newline at end of file diff --git a/Lang/Perl/Balanced_brackets b/Lang/Perl/Balanced_brackets new file mode 120000 index 0000000000..69e847045e --- /dev/null +++ b/Lang/Perl/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Perl \ No newline at end of file diff --git a/Lang/Perl/Best_shuffle b/Lang/Perl/Best_shuffle new file mode 120000 index 0000000000..cc40818d78 --- /dev/null +++ b/Lang/Perl/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Perl \ No newline at end of file diff --git a/Lang/Perl/Binary_digits b/Lang/Perl/Binary_digits new file mode 120000 index 0000000000..611f546c2b --- /dev/null +++ b/Lang/Perl/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Perl \ No newline at end of file diff --git a/Lang/Perl/Binary_search b/Lang/Perl/Binary_search new file mode 120000 index 0000000000..482eb36f62 --- /dev/null +++ b/Lang/Perl/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Perl \ No newline at end of file diff --git a/Lang/Perl/Caesar_cipher b/Lang/Perl/Caesar_cipher new file mode 120000 index 0000000000..c1db1f4851 --- /dev/null +++ b/Lang/Perl/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Perl \ No newline at end of file diff --git a/Lang/Perl/Calendar b/Lang/Perl/Calendar new file mode 120000 index 0000000000..7bda2f4017 --- /dev/null +++ b/Lang/Perl/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Perl \ No newline at end of file diff --git a/Lang/Perl/Check_that_file_exists b/Lang/Perl/Check_that_file_exists new file mode 120000 index 0000000000..ebdfc119a0 --- /dev/null +++ b/Lang/Perl/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Perl \ No newline at end of file diff --git a/Lang/Perl/Checkpoint_synchronization b/Lang/Perl/Checkpoint_synchronization new file mode 120000 index 0000000000..ce11b9cdf1 --- /dev/null +++ b/Lang/Perl/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Perl \ No newline at end of file diff --git a/Lang/Perl/Classes b/Lang/Perl/Classes new file mode 120000 index 0000000000..9ae9ef1e5b --- /dev/null +++ b/Lang/Perl/Classes @@ -0,0 +1 @@ +../../Task/Classes/Perl \ No newline at end of file diff --git a/Lang/Perl/Closest-pair_problem b/Lang/Perl/Closest-pair_problem new file mode 120000 index 0000000000..8916d6034d --- /dev/null +++ b/Lang/Perl/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Perl \ No newline at end of file diff --git a/Lang/Perl/Collections b/Lang/Perl/Collections new file mode 120000 index 0000000000..8d86ab96eb --- /dev/null +++ b/Lang/Perl/Collections @@ -0,0 +1 @@ +../../Task/Collections/Perl \ No newline at end of file diff --git a/Lang/Perl/Define_a_primitive_data_type b/Lang/Perl/Define_a_primitive_data_type new file mode 120000 index 0000000000..6d3b0bb932 --- /dev/null +++ b/Lang/Perl/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Perl \ No newline at end of file diff --git a/Lang/Perl/Delegates b/Lang/Perl/Delegates new file mode 120000 index 0000000000..5e498e43d9 --- /dev/null +++ b/Lang/Perl/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Perl \ No newline at end of file diff --git a/Lang/Perl/Delete_a_file b/Lang/Perl/Delete_a_file new file mode 120000 index 0000000000..b3a8eaf983 --- /dev/null +++ b/Lang/Perl/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Perl \ No newline at end of file diff --git a/Lang/Perl/Detect_division_by_zero b/Lang/Perl/Detect_division_by_zero new file mode 120000 index 0000000000..68790e3f15 --- /dev/null +++ b/Lang/Perl/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Perl \ No newline at end of file diff --git a/Lang/Perl/Determine_if_a_string_is_numeric b/Lang/Perl/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..5a01eea35e --- /dev/null +++ b/Lang/Perl/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Perl \ No newline at end of file diff --git a/Lang/Perl/Forest_fire b/Lang/Perl/Forest_fire new file mode 120000 index 0000000000..64cde10e24 --- /dev/null +++ b/Lang/Perl/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Perl \ No newline at end of file diff --git a/Lang/PicoLisp/Ackermann_function b/Lang/PicoLisp/Ackermann_function new file mode 120000 index 0000000000..0860eb00bc --- /dev/null +++ b/Lang/PicoLisp/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Arrays b/Lang/PicoLisp/Arrays new file mode 120000 index 0000000000..4cb6ab1a90 --- /dev/null +++ b/Lang/PicoLisp/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Assertions b/Lang/PicoLisp/Assertions new file mode 120000 index 0000000000..eb09175dd9 --- /dev/null +++ b/Lang/PicoLisp/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Balanced_brackets b/Lang/PicoLisp/Balanced_brackets new file mode 120000 index 0000000000..163476c3e5 --- /dev/null +++ b/Lang/PicoLisp/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Best_shuffle b/Lang/PicoLisp/Best_shuffle new file mode 120000 index 0000000000..26eaf030be --- /dev/null +++ b/Lang/PicoLisp/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Binary_digits b/Lang/PicoLisp/Binary_digits new file mode 120000 index 0000000000..2a55ec7c92 --- /dev/null +++ b/Lang/PicoLisp/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Binary_search b/Lang/PicoLisp/Binary_search new file mode 120000 index 0000000000..85482b3de9 --- /dev/null +++ b/Lang/PicoLisp/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Binary_strings b/Lang/PicoLisp/Binary_strings new file mode 120000 index 0000000000..fd18d7f636 --- /dev/null +++ b/Lang/PicoLisp/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Caesar_cipher b/Lang/PicoLisp/Caesar_cipher new file mode 120000 index 0000000000..b5c3f19f68 --- /dev/null +++ b/Lang/PicoLisp/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Calendar b/Lang/PicoLisp/Calendar new file mode 120000 index 0000000000..36c3b23372 --- /dev/null +++ b/Lang/PicoLisp/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Check_that_file_exists b/Lang/PicoLisp/Check_that_file_exists new file mode 120000 index 0000000000..e760466873 --- /dev/null +++ b/Lang/PicoLisp/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Checkpoint_synchronization b/Lang/PicoLisp/Checkpoint_synchronization new file mode 120000 index 0000000000..de22dd674e --- /dev/null +++ b/Lang/PicoLisp/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Classes b/Lang/PicoLisp/Classes new file mode 120000 index 0000000000..6d026e0620 --- /dev/null +++ b/Lang/PicoLisp/Classes @@ -0,0 +1 @@ +../../Task/Classes/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Closest-pair_problem b/Lang/PicoLisp/Closest-pair_problem new file mode 120000 index 0000000000..af5b721875 --- /dev/null +++ b/Lang/PicoLisp/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Collections b/Lang/PicoLisp/Collections new file mode 120000 index 0000000000..2df1a035ad --- /dev/null +++ b/Lang/PicoLisp/Collections @@ -0,0 +1 @@ +../../Task/Collections/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Color_of_a_screen_pixel b/Lang/PicoLisp/Color_of_a_screen_pixel new file mode 120000 index 0000000000..f4d89acfc6 --- /dev/null +++ b/Lang/PicoLisp/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Define_a_primitive_data_type b/Lang/PicoLisp/Define_a_primitive_data_type new file mode 120000 index 0000000000..4f7203b753 --- /dev/null +++ b/Lang/PicoLisp/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Delegates b/Lang/PicoLisp/Delegates new file mode 120000 index 0000000000..55c98904e1 --- /dev/null +++ b/Lang/PicoLisp/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Delete_a_file b/Lang/PicoLisp/Delete_a_file new file mode 120000 index 0000000000..4eccaa0389 --- /dev/null +++ b/Lang/PicoLisp/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Detect_division_by_zero b/Lang/PicoLisp/Detect_division_by_zero new file mode 120000 index 0000000000..863c9bf27d --- /dev/null +++ b/Lang/PicoLisp/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Determine_if_a_string_is_numeric b/Lang/PicoLisp/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..bb95799942 --- /dev/null +++ b/Lang/PicoLisp/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Forest_fire b/Lang/PicoLisp/Forest_fire new file mode 120000 index 0000000000..76ff9d0554 --- /dev/null +++ b/Lang/PicoLisp/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/PicoLisp \ No newline at end of file diff --git a/Lang/Prolog/Ackermann_function b/Lang/Prolog/Ackermann_function new file mode 120000 index 0000000000..abe3a9263c --- /dev/null +++ b/Lang/Prolog/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Arrays b/Lang/Prolog/Arrays new file mode 120000 index 0000000000..a0095048d4 --- /dev/null +++ b/Lang/Prolog/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Assertions b/Lang/Prolog/Assertions new file mode 120000 index 0000000000..b2441f595c --- /dev/null +++ b/Lang/Prolog/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Balanced_brackets b/Lang/Prolog/Balanced_brackets new file mode 120000 index 0000000000..1102adfb5a --- /dev/null +++ b/Lang/Prolog/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Balanced_ternary b/Lang/Prolog/Balanced_ternary new file mode 120000 index 0000000000..d6e2e6c5cf --- /dev/null +++ b/Lang/Prolog/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Best_shuffle b/Lang/Prolog/Best_shuffle new file mode 120000 index 0000000000..ced3de5b4b --- /dev/null +++ b/Lang/Prolog/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Caesar_cipher b/Lang/Prolog/Caesar_cipher new file mode 120000 index 0000000000..6cfe3799d6 --- /dev/null +++ b/Lang/Prolog/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Prolog \ No newline at end of file diff --git a/Lang/Python/Ackermann_function b/Lang/Python/Ackermann_function new file mode 120000 index 0000000000..db95a47ba0 --- /dev/null +++ b/Lang/Python/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Python \ No newline at end of file diff --git a/Lang/Python/Arrays b/Lang/Python/Arrays new file mode 120000 index 0000000000..26e8887e8d --- /dev/null +++ b/Lang/Python/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Python \ No newline at end of file diff --git a/Lang/Python/Assertions b/Lang/Python/Assertions new file mode 120000 index 0000000000..fdd75ecc4d --- /dev/null +++ b/Lang/Python/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Python \ No newline at end of file diff --git a/Lang/Python/Balanced_brackets b/Lang/Python/Balanced_brackets new file mode 120000 index 0000000000..0049f60503 --- /dev/null +++ b/Lang/Python/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Python \ No newline at end of file diff --git a/Lang/Python/Balanced_ternary b/Lang/Python/Balanced_ternary new file mode 120000 index 0000000000..aad806d1cc --- /dev/null +++ b/Lang/Python/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Python \ No newline at end of file diff --git a/Lang/Python/Best_shuffle b/Lang/Python/Best_shuffle new file mode 120000 index 0000000000..0ce0aadc21 --- /dev/null +++ b/Lang/Python/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Python \ No newline at end of file diff --git a/Lang/Python/Binary_digits b/Lang/Python/Binary_digits new file mode 120000 index 0000000000..9a585c97e6 --- /dev/null +++ b/Lang/Python/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Python \ No newline at end of file diff --git a/Lang/Python/Binary_search b/Lang/Python/Binary_search new file mode 120000 index 0000000000..9d2702ac20 --- /dev/null +++ b/Lang/Python/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Python \ No newline at end of file diff --git a/Lang/Python/Binary_strings b/Lang/Python/Binary_strings new file mode 120000 index 0000000000..690400aa68 --- /dev/null +++ b/Lang/Python/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Python \ No newline at end of file diff --git a/Lang/Python/Caesar_cipher b/Lang/Python/Caesar_cipher new file mode 120000 index 0000000000..4cd450503c --- /dev/null +++ b/Lang/Python/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Python \ No newline at end of file diff --git a/Lang/Python/Calendar b/Lang/Python/Calendar new file mode 120000 index 0000000000..a3f19087f6 --- /dev/null +++ b/Lang/Python/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Python \ No newline at end of file diff --git a/Lang/Python/Check_that_file_exists b/Lang/Python/Check_that_file_exists new file mode 120000 index 0000000000..09e38a7234 --- /dev/null +++ b/Lang/Python/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Python \ No newline at end of file diff --git a/Lang/Python/Classes b/Lang/Python/Classes new file mode 120000 index 0000000000..08c34cc85f --- /dev/null +++ b/Lang/Python/Classes @@ -0,0 +1 @@ +../../Task/Classes/Python \ No newline at end of file diff --git a/Lang/Python/Closest-pair_problem b/Lang/Python/Closest-pair_problem new file mode 120000 index 0000000000..b7dfc8bf37 --- /dev/null +++ b/Lang/Python/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Python \ No newline at end of file diff --git a/Lang/Python/Collections b/Lang/Python/Collections new file mode 120000 index 0000000000..038e0c0c1a --- /dev/null +++ b/Lang/Python/Collections @@ -0,0 +1 @@ +../../Task/Collections/Python \ No newline at end of file diff --git a/Lang/Python/Color_of_a_screen_pixel b/Lang/Python/Color_of_a_screen_pixel new file mode 120000 index 0000000000..2e41e1cb7b --- /dev/null +++ b/Lang/Python/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/Python \ No newline at end of file diff --git a/Lang/Python/Define_a_primitive_data_type b/Lang/Python/Define_a_primitive_data_type new file mode 120000 index 0000000000..bfcf8f0283 --- /dev/null +++ b/Lang/Python/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Python \ No newline at end of file diff --git a/Lang/Python/Delegates b/Lang/Python/Delegates new file mode 120000 index 0000000000..8e6feb8d63 --- /dev/null +++ b/Lang/Python/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Python \ No newline at end of file diff --git a/Lang/Python/Delete_a_file b/Lang/Python/Delete_a_file new file mode 120000 index 0000000000..f3abbc0754 --- /dev/null +++ b/Lang/Python/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Python \ No newline at end of file diff --git a/Lang/Python/Detect_division_by_zero b/Lang/Python/Detect_division_by_zero new file mode 120000 index 0000000000..e09410b48d --- /dev/null +++ b/Lang/Python/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Python \ No newline at end of file diff --git a/Lang/Python/Determine_if_a_string_is_numeric b/Lang/Python/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..d7387c27c2 --- /dev/null +++ b/Lang/Python/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Python \ No newline at end of file diff --git a/Lang/Python/Forest_fire b/Lang/Python/Forest_fire new file mode 120000 index 0000000000..1b4faadd47 --- /dev/null +++ b/Lang/Python/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Python \ No newline at end of file diff --git a/Lang/R/Ackermann_function b/Lang/R/Ackermann_function new file mode 120000 index 0000000000..75a03143ca --- /dev/null +++ b/Lang/R/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/R \ No newline at end of file diff --git a/Lang/R/Arrays b/Lang/R/Arrays new file mode 120000 index 0000000000..c143f3c58f --- /dev/null +++ b/Lang/R/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/R \ No newline at end of file diff --git a/Lang/R/Assertions b/Lang/R/Assertions new file mode 120000 index 0000000000..50b202ce11 --- /dev/null +++ b/Lang/R/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/R \ No newline at end of file diff --git a/Lang/R/Balanced_brackets b/Lang/R/Balanced_brackets new file mode 120000 index 0000000000..a3fb2564cb --- /dev/null +++ b/Lang/R/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/R \ No newline at end of file diff --git a/Lang/R/Binary_search b/Lang/R/Binary_search new file mode 120000 index 0000000000..8908ddc9f4 --- /dev/null +++ b/Lang/R/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/R \ No newline at end of file diff --git a/Lang/R/Check_that_file_exists b/Lang/R/Check_that_file_exists new file mode 120000 index 0000000000..0c16bb1004 --- /dev/null +++ b/Lang/R/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/R \ No newline at end of file diff --git a/Lang/R/Classes b/Lang/R/Classes new file mode 120000 index 0000000000..62c91e4b93 --- /dev/null +++ b/Lang/R/Classes @@ -0,0 +1 @@ +../../Task/Classes/R \ No newline at end of file diff --git a/Lang/R/Closest-pair_problem b/Lang/R/Closest-pair_problem new file mode 120000 index 0000000000..8e472031ee --- /dev/null +++ b/Lang/R/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/R \ No newline at end of file diff --git a/Lang/R/Collections b/Lang/R/Collections new file mode 120000 index 0000000000..32ac24a507 --- /dev/null +++ b/Lang/R/Collections @@ -0,0 +1 @@ +../../Task/Collections/R \ No newline at end of file diff --git a/Lang/R/Delete_a_file b/Lang/R/Delete_a_file new file mode 120000 index 0000000000..7fd8bb44ed --- /dev/null +++ b/Lang/R/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/R \ No newline at end of file diff --git a/Lang/R/Detect_division_by_zero b/Lang/R/Detect_division_by_zero new file mode 120000 index 0000000000..186e046992 --- /dev/null +++ b/Lang/R/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/R \ No newline at end of file diff --git a/Lang/R/Determine_if_a_string_is_numeric b/Lang/R/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..00abfc7797 --- /dev/null +++ b/Lang/R/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/R \ No newline at end of file diff --git a/Lang/REXX/Ackermann_function b/Lang/REXX/Ackermann_function new file mode 120000 index 0000000000..ac38636546 --- /dev/null +++ b/Lang/REXX/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/REXX \ No newline at end of file diff --git a/Lang/REXX/Arrays b/Lang/REXX/Arrays new file mode 120000 index 0000000000..4e33d13f31 --- /dev/null +++ b/Lang/REXX/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/REXX \ No newline at end of file diff --git a/Lang/REXX/Assertions b/Lang/REXX/Assertions new file mode 120000 index 0000000000..1ba0e4c9d8 --- /dev/null +++ b/Lang/REXX/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/REXX \ No newline at end of file diff --git a/Lang/REXX/Balanced_brackets b/Lang/REXX/Balanced_brackets new file mode 120000 index 0000000000..5d91a2f67a --- /dev/null +++ b/Lang/REXX/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/REXX \ No newline at end of file diff --git a/Lang/REXX/Balanced_ternary b/Lang/REXX/Balanced_ternary new file mode 120000 index 0000000000..66ebdbe44f --- /dev/null +++ b/Lang/REXX/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/REXX \ No newline at end of file diff --git a/Lang/REXX/Best_shuffle b/Lang/REXX/Best_shuffle new file mode 120000 index 0000000000..b46c99d9bf --- /dev/null +++ b/Lang/REXX/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/REXX \ No newline at end of file diff --git a/Lang/REXX/Binary_search b/Lang/REXX/Binary_search new file mode 120000 index 0000000000..94154b1058 --- /dev/null +++ b/Lang/REXX/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/REXX \ No newline at end of file diff --git a/Lang/REXX/Binary_strings b/Lang/REXX/Binary_strings new file mode 120000 index 0000000000..d51174eb44 --- /dev/null +++ b/Lang/REXX/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/REXX \ No newline at end of file diff --git a/Lang/REXX/Caesar_cipher b/Lang/REXX/Caesar_cipher new file mode 120000 index 0000000000..3ffd4d7bbf --- /dev/null +++ b/Lang/REXX/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/REXX \ No newline at end of file diff --git a/Lang/REXX/Calendar b/Lang/REXX/Calendar new file mode 120000 index 0000000000..5f942a8a7a --- /dev/null +++ b/Lang/REXX/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/REXX \ No newline at end of file diff --git a/Lang/REXX/Closest-pair_problem b/Lang/REXX/Closest-pair_problem new file mode 120000 index 0000000000..1989b05ca5 --- /dev/null +++ b/Lang/REXX/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/REXX \ No newline at end of file diff --git a/Lang/REXX/Collections b/Lang/REXX/Collections new file mode 120000 index 0000000000..ef5d0bf812 --- /dev/null +++ b/Lang/REXX/Collections @@ -0,0 +1 @@ +../../Task/Collections/REXX \ No newline at end of file diff --git a/Lang/REXX/Detect_division_by_zero b/Lang/REXX/Detect_division_by_zero new file mode 120000 index 0000000000..252db972e6 --- /dev/null +++ b/Lang/REXX/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/REXX \ No newline at end of file diff --git a/Lang/REXX/Determine_if_a_string_is_numeric b/Lang/REXX/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..3b3bbded06 --- /dev/null +++ b/Lang/REXX/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/REXX \ No newline at end of file diff --git a/Lang/REXX/Forest_fire b/Lang/REXX/Forest_fire new file mode 120000 index 0000000000..0164ce855e --- /dev/null +++ b/Lang/REXX/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/REXX \ No newline at end of file diff --git a/Lang/Racket/Ackermann_function b/Lang/Racket/Ackermann_function new file mode 120000 index 0000000000..0ce0cebbca --- /dev/null +++ b/Lang/Racket/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Racket \ No newline at end of file diff --git a/Lang/Racket/Arrays b/Lang/Racket/Arrays new file mode 120000 index 0000000000..e2fde46f3d --- /dev/null +++ b/Lang/Racket/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Racket \ No newline at end of file diff --git a/Lang/Racket/Assertions b/Lang/Racket/Assertions new file mode 120000 index 0000000000..9f88cdd4da --- /dev/null +++ b/Lang/Racket/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Racket \ No newline at end of file diff --git a/Lang/Racket/Balanced_brackets b/Lang/Racket/Balanced_brackets new file mode 120000 index 0000000000..5b3a2e09f7 --- /dev/null +++ b/Lang/Racket/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Racket \ No newline at end of file diff --git a/Lang/Racket/Best_shuffle b/Lang/Racket/Best_shuffle new file mode 120000 index 0000000000..2e028b99e6 --- /dev/null +++ b/Lang/Racket/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Racket \ No newline at end of file diff --git a/Lang/Racket/Binary_digits b/Lang/Racket/Binary_digits new file mode 120000 index 0000000000..f0409e630f --- /dev/null +++ b/Lang/Racket/Binary_digits @@ -0,0 +1 @@ +../../Task/Binary_digits/Racket \ No newline at end of file diff --git a/Lang/Racket/Binary_search b/Lang/Racket/Binary_search new file mode 120000 index 0000000000..3fbcfbce35 --- /dev/null +++ b/Lang/Racket/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Racket \ No newline at end of file diff --git a/Lang/Racket/Binary_strings b/Lang/Racket/Binary_strings new file mode 120000 index 0000000000..dc568d5154 --- /dev/null +++ b/Lang/Racket/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Racket \ No newline at end of file diff --git a/Lang/Racket/Caesar_cipher b/Lang/Racket/Caesar_cipher new file mode 120000 index 0000000000..b5db75d440 --- /dev/null +++ b/Lang/Racket/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Racket \ No newline at end of file diff --git a/Lang/Racket/Classes b/Lang/Racket/Classes new file mode 120000 index 0000000000..8b30b00002 --- /dev/null +++ b/Lang/Racket/Classes @@ -0,0 +1 @@ +../../Task/Classes/Racket \ No newline at end of file diff --git a/Lang/Racket/Define_a_primitive_data_type b/Lang/Racket/Define_a_primitive_data_type new file mode 120000 index 0000000000..828fbcdffd --- /dev/null +++ b/Lang/Racket/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Racket \ No newline at end of file diff --git a/Lang/Racket/Detect_division_by_zero b/Lang/Racket/Detect_division_by_zero new file mode 120000 index 0000000000..e052f1e451 --- /dev/null +++ b/Lang/Racket/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Racket \ No newline at end of file diff --git a/Lang/Racket/Determine_if_a_string_is_numeric b/Lang/Racket/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..90dafcb43a --- /dev/null +++ b/Lang/Racket/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Racket \ No newline at end of file diff --git a/Lang/Racket/Forest_fire b/Lang/Racket/Forest_fire new file mode 120000 index 0000000000..371defd5b6 --- /dev/null +++ b/Lang/Racket/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Racket \ No newline at end of file diff --git a/Lang/Ruby/Ackermann_function b/Lang/Ruby/Ackermann_function new file mode 120000 index 0000000000..65385a6c81 --- /dev/null +++ b/Lang/Ruby/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Arrays b/Lang/Ruby/Arrays new file mode 120000 index 0000000000..4234e52c3f --- /dev/null +++ b/Lang/Ruby/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Assertions b/Lang/Ruby/Assertions new file mode 120000 index 0000000000..d4fcc65be1 --- /dev/null +++ b/Lang/Ruby/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Balanced_brackets b/Lang/Ruby/Balanced_brackets new file mode 120000 index 0000000000..ed93c58340 --- /dev/null +++ b/Lang/Ruby/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Balanced_ternary b/Lang/Ruby/Balanced_ternary new file mode 120000 index 0000000000..38707dbac0 --- /dev/null +++ b/Lang/Ruby/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Binary_search b/Lang/Ruby/Binary_search new file mode 120000 index 0000000000..b470f329a6 --- /dev/null +++ b/Lang/Ruby/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Binary_strings b/Lang/Ruby/Binary_strings new file mode 120000 index 0000000000..170a231c2e --- /dev/null +++ b/Lang/Ruby/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Caesar_cipher b/Lang/Ruby/Caesar_cipher new file mode 120000 index 0000000000..226d56d19c --- /dev/null +++ b/Lang/Ruby/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Calendar b/Lang/Ruby/Calendar new file mode 120000 index 0000000000..e86988259e --- /dev/null +++ b/Lang/Ruby/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Check_that_file_exists b/Lang/Ruby/Check_that_file_exists new file mode 120000 index 0000000000..a4be94da06 --- /dev/null +++ b/Lang/Ruby/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Checkpoint_synchronization b/Lang/Ruby/Checkpoint_synchronization new file mode 120000 index 0000000000..3bb41e74a1 --- /dev/null +++ b/Lang/Ruby/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Classes b/Lang/Ruby/Classes new file mode 120000 index 0000000000..6df1c2eb01 --- /dev/null +++ b/Lang/Ruby/Classes @@ -0,0 +1 @@ +../../Task/Classes/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Closest-pair_problem b/Lang/Ruby/Closest-pair_problem new file mode 120000 index 0000000000..6b25d16fe7 --- /dev/null +++ b/Lang/Ruby/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Collections b/Lang/Ruby/Collections new file mode 120000 index 0000000000..33bd952e1d --- /dev/null +++ b/Lang/Ruby/Collections @@ -0,0 +1 @@ +../../Task/Collections/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Define_a_primitive_data_type b/Lang/Ruby/Define_a_primitive_data_type new file mode 120000 index 0000000000..8e6cb9d547 --- /dev/null +++ b/Lang/Ruby/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Delegates b/Lang/Ruby/Delegates new file mode 120000 index 0000000000..61a239624d --- /dev/null +++ b/Lang/Ruby/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Delete_a_file b/Lang/Ruby/Delete_a_file new file mode 120000 index 0000000000..50dc270229 --- /dev/null +++ b/Lang/Ruby/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Detect_division_by_zero b/Lang/Ruby/Detect_division_by_zero new file mode 120000 index 0000000000..901a788d21 --- /dev/null +++ b/Lang/Ruby/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Determine_if_a_string_is_numeric b/Lang/Ruby/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..dee2dc20e9 --- /dev/null +++ b/Lang/Ruby/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Forest_fire b/Lang/Ruby/Forest_fire new file mode 120000 index 0000000000..403a1e996c --- /dev/null +++ b/Lang/Ruby/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Ruby \ No newline at end of file diff --git a/Lang/SNUSP/Ackermann_function b/Lang/SNUSP/Ackermann_function new file mode 120000 index 0000000000..d962f39bfb --- /dev/null +++ b/Lang/SNUSP/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/SNUSP \ No newline at end of file diff --git a/Lang/Sather/Ackermann_function b/Lang/Sather/Ackermann_function new file mode 120000 index 0000000000..8de6a4f1ed --- /dev/null +++ b/Lang/Sather/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Sather \ No newline at end of file diff --git a/Lang/Sather/Arrays b/Lang/Sather/Arrays new file mode 120000 index 0000000000..d024ed301f --- /dev/null +++ b/Lang/Sather/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Sather \ No newline at end of file diff --git a/Lang/Sather/Assertions b/Lang/Sather/Assertions new file mode 120000 index 0000000000..7073df8ac0 --- /dev/null +++ b/Lang/Sather/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Sather \ No newline at end of file diff --git a/Lang/Sather/Classes b/Lang/Sather/Classes new file mode 120000 index 0000000000..cc6bcaead3 --- /dev/null +++ b/Lang/Sather/Classes @@ -0,0 +1 @@ +../../Task/Classes/Sather \ No newline at end of file diff --git a/Lang/Sather/Forest_fire b/Lang/Sather/Forest_fire new file mode 120000 index 0000000000..322254f8d6 --- /dev/null +++ b/Lang/Sather/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Sather \ No newline at end of file diff --git a/Lang/Scala/Ackermann_function b/Lang/Scala/Ackermann_function new file mode 120000 index 0000000000..16dc56280c --- /dev/null +++ b/Lang/Scala/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Scala \ No newline at end of file diff --git a/Lang/Scala/Arrays b/Lang/Scala/Arrays new file mode 120000 index 0000000000..edaa9783d9 --- /dev/null +++ b/Lang/Scala/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Scala \ No newline at end of file diff --git a/Lang/Scala/Assertions b/Lang/Scala/Assertions new file mode 120000 index 0000000000..6d1eb7ed04 --- /dev/null +++ b/Lang/Scala/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Scala \ No newline at end of file diff --git a/Lang/Scala/Balanced_brackets b/Lang/Scala/Balanced_brackets new file mode 120000 index 0000000000..b93337b0b7 --- /dev/null +++ b/Lang/Scala/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Scala \ No newline at end of file diff --git a/Lang/Scala/Binary_search b/Lang/Scala/Binary_search new file mode 120000 index 0000000000..f9a3275149 --- /dev/null +++ b/Lang/Scala/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Scala \ No newline at end of file diff --git a/Lang/Scala/Caesar_cipher b/Lang/Scala/Caesar_cipher new file mode 120000 index 0000000000..aa06e27520 --- /dev/null +++ b/Lang/Scala/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Scala \ No newline at end of file diff --git a/Lang/Scala/Calendar b/Lang/Scala/Calendar new file mode 120000 index 0000000000..5bb482cccf --- /dev/null +++ b/Lang/Scala/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Scala \ No newline at end of file diff --git a/Lang/Scala/Classes b/Lang/Scala/Classes new file mode 120000 index 0000000000..fdcbc166f6 --- /dev/null +++ b/Lang/Scala/Classes @@ -0,0 +1 @@ +../../Task/Classes/Scala \ No newline at end of file diff --git a/Lang/Scala/Closest-pair_problem b/Lang/Scala/Closest-pair_problem new file mode 120000 index 0000000000..09e74c93ec --- /dev/null +++ b/Lang/Scala/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Scala \ No newline at end of file diff --git a/Lang/Scala/Collections b/Lang/Scala/Collections new file mode 120000 index 0000000000..7daa779cfd --- /dev/null +++ b/Lang/Scala/Collections @@ -0,0 +1 @@ +../../Task/Collections/Scala \ No newline at end of file diff --git a/Lang/Scala/Detect_division_by_zero b/Lang/Scala/Detect_division_by_zero new file mode 120000 index 0000000000..3f8a21cf49 --- /dev/null +++ b/Lang/Scala/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Scala \ No newline at end of file diff --git a/Lang/Scala/Determine_if_a_string_is_numeric b/Lang/Scala/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..142525395e --- /dev/null +++ b/Lang/Scala/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Scala \ No newline at end of file diff --git a/Lang/Scala/Forest_fire b/Lang/Scala/Forest_fire new file mode 120000 index 0000000000..9204e4d5c7 --- /dev/null +++ b/Lang/Scala/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Scala \ No newline at end of file diff --git a/Lang/Scheme/Ackermann_function b/Lang/Scheme/Ackermann_function new file mode 120000 index 0000000000..e348071d64 --- /dev/null +++ b/Lang/Scheme/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Arrays b/Lang/Scheme/Arrays new file mode 120000 index 0000000000..2846effdd9 --- /dev/null +++ b/Lang/Scheme/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Assertions b/Lang/Scheme/Assertions new file mode 120000 index 0000000000..629b29c33e --- /dev/null +++ b/Lang/Scheme/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Balanced_brackets b/Lang/Scheme/Balanced_brackets new file mode 120000 index 0000000000..3e7213bbd7 --- /dev/null +++ b/Lang/Scheme/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Best_shuffle b/Lang/Scheme/Best_shuffle new file mode 120000 index 0000000000..b14550e901 --- /dev/null +++ b/Lang/Scheme/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Binary_search b/Lang/Scheme/Binary_search new file mode 120000 index 0000000000..f6824a56e6 --- /dev/null +++ b/Lang/Scheme/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Check_that_file_exists b/Lang/Scheme/Check_that_file_exists new file mode 120000 index 0000000000..6c730e590c --- /dev/null +++ b/Lang/Scheme/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Classes b/Lang/Scheme/Classes new file mode 120000 index 0000000000..030f2f3b01 --- /dev/null +++ b/Lang/Scheme/Classes @@ -0,0 +1 @@ +../../Task/Classes/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Collections b/Lang/Scheme/Collections new file mode 120000 index 0000000000..35307fc159 --- /dev/null +++ b/Lang/Scheme/Collections @@ -0,0 +1 @@ +../../Task/Collections/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Delete_a_file b/Lang/Scheme/Delete_a_file new file mode 120000 index 0000000000..323ae2048a --- /dev/null +++ b/Lang/Scheme/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Determine_if_a_string_is_numeric b/Lang/Scheme/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..c6d043a593 --- /dev/null +++ b/Lang/Scheme/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Scheme \ No newline at end of file diff --git a/Lang/Smalltalk/Ackermann_function b/Lang/Smalltalk/Ackermann_function new file mode 120000 index 0000000000..5aa800c970 --- /dev/null +++ b/Lang/Smalltalk/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Arrays b/Lang/Smalltalk/Arrays new file mode 120000 index 0000000000..310d6ee82e --- /dev/null +++ b/Lang/Smalltalk/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Assertions b/Lang/Smalltalk/Assertions new file mode 120000 index 0000000000..55c4373814 --- /dev/null +++ b/Lang/Smalltalk/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Caesar_cipher b/Lang/Smalltalk/Caesar_cipher new file mode 120000 index 0000000000..d7898e0503 --- /dev/null +++ b/Lang/Smalltalk/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Check_that_file_exists b/Lang/Smalltalk/Check_that_file_exists new file mode 120000 index 0000000000..ed8117c3e9 --- /dev/null +++ b/Lang/Smalltalk/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Classes b/Lang/Smalltalk/Classes new file mode 120000 index 0000000000..e0c6d5d69e --- /dev/null +++ b/Lang/Smalltalk/Classes @@ -0,0 +1 @@ +../../Task/Classes/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Collections b/Lang/Smalltalk/Collections new file mode 120000 index 0000000000..7a67353cbe --- /dev/null +++ b/Lang/Smalltalk/Collections @@ -0,0 +1 @@ +../../Task/Collections/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Delete_a_file b/Lang/Smalltalk/Delete_a_file new file mode 120000 index 0000000000..18bcc7a2ca --- /dev/null +++ b/Lang/Smalltalk/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Detect_division_by_zero b/Lang/Smalltalk/Detect_division_by_zero new file mode 120000 index 0000000000..08dbe99b2e --- /dev/null +++ b/Lang/Smalltalk/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Determine_if_a_string_is_numeric b/Lang/Smalltalk/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..e5839d1169 --- /dev/null +++ b/Lang/Smalltalk/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Smalltalk \ No newline at end of file diff --git a/Lang/Tcl/Ackermann_function b/Lang/Tcl/Ackermann_function new file mode 120000 index 0000000000..a91cf006af --- /dev/null +++ b/Lang/Tcl/Ackermann_function @@ -0,0 +1 @@ +../../Task/Ackermann_function/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Arrays b/Lang/Tcl/Arrays new file mode 120000 index 0000000000..d4505262cf --- /dev/null +++ b/Lang/Tcl/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Assertions b/Lang/Tcl/Assertions new file mode 120000 index 0000000000..cfd47d37ef --- /dev/null +++ b/Lang/Tcl/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Balanced_brackets b/Lang/Tcl/Balanced_brackets new file mode 120000 index 0000000000..e51729031b --- /dev/null +++ b/Lang/Tcl/Balanced_brackets @@ -0,0 +1 @@ +../../Task/Balanced_brackets/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Balanced_ternary b/Lang/Tcl/Balanced_ternary new file mode 120000 index 0000000000..0c5264fc1d --- /dev/null +++ b/Lang/Tcl/Balanced_ternary @@ -0,0 +1 @@ +../../Task/Balanced_ternary/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Best_shuffle b/Lang/Tcl/Best_shuffle new file mode 120000 index 0000000000..15fcbf3d7d --- /dev/null +++ b/Lang/Tcl/Best_shuffle @@ -0,0 +1 @@ +../../Task/Best_shuffle/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Binary_search b/Lang/Tcl/Binary_search new file mode 120000 index 0000000000..16176c4dbb --- /dev/null +++ b/Lang/Tcl/Binary_search @@ -0,0 +1 @@ +../../Task/Binary_search/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Binary_strings b/Lang/Tcl/Binary_strings new file mode 120000 index 0000000000..92ea902030 --- /dev/null +++ b/Lang/Tcl/Binary_strings @@ -0,0 +1 @@ +../../Task/Binary_strings/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Caesar_cipher b/Lang/Tcl/Caesar_cipher new file mode 120000 index 0000000000..53bc6cdce7 --- /dev/null +++ b/Lang/Tcl/Caesar_cipher @@ -0,0 +1 @@ +../../Task/Caesar_cipher/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Calendar b/Lang/Tcl/Calendar new file mode 120000 index 0000000000..8a814ca675 --- /dev/null +++ b/Lang/Tcl/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Check_that_file_exists b/Lang/Tcl/Check_that_file_exists new file mode 120000 index 0000000000..60b3c5f0a9 --- /dev/null +++ b/Lang/Tcl/Check_that_file_exists @@ -0,0 +1 @@ +../../Task/Check_that_file_exists/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Checkpoint_synchronization b/Lang/Tcl/Checkpoint_synchronization new file mode 120000 index 0000000000..4011b9a85a --- /dev/null +++ b/Lang/Tcl/Checkpoint_synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint_synchronization/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Classes b/Lang/Tcl/Classes new file mode 120000 index 0000000000..253c018841 --- /dev/null +++ b/Lang/Tcl/Classes @@ -0,0 +1 @@ +../../Task/Classes/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Closest-pair_problem b/Lang/Tcl/Closest-pair_problem new file mode 120000 index 0000000000..68c0f5ebd0 --- /dev/null +++ b/Lang/Tcl/Closest-pair_problem @@ -0,0 +1 @@ +../../Task/Closest-pair_problem/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Collections b/Lang/Tcl/Collections new file mode 120000 index 0000000000..9b0cb2c550 --- /dev/null +++ b/Lang/Tcl/Collections @@ -0,0 +1 @@ +../../Task/Collections/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Color_of_a_screen_pixel b/Lang/Tcl/Color_of_a_screen_pixel new file mode 120000 index 0000000000..ee5c8b62c1 --- /dev/null +++ b/Lang/Tcl/Color_of_a_screen_pixel @@ -0,0 +1 @@ +../../Task/Color_of_a_screen_pixel/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Define_a_primitive_data_type b/Lang/Tcl/Define_a_primitive_data_type new file mode 120000 index 0000000000..e36f1e2750 --- /dev/null +++ b/Lang/Tcl/Define_a_primitive_data_type @@ -0,0 +1 @@ +../../Task/Define_a_primitive_data_type/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Delegates b/Lang/Tcl/Delegates new file mode 120000 index 0000000000..37b80ff744 --- /dev/null +++ b/Lang/Tcl/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Delete_a_file b/Lang/Tcl/Delete_a_file new file mode 120000 index 0000000000..32b204bb52 --- /dev/null +++ b/Lang/Tcl/Delete_a_file @@ -0,0 +1 @@ +../../Task/Delete_a_file/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Detect_division_by_zero b/Lang/Tcl/Detect_division_by_zero new file mode 120000 index 0000000000..ca47511d85 --- /dev/null +++ b/Lang/Tcl/Detect_division_by_zero @@ -0,0 +1 @@ +../../Task/Detect_division_by_zero/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Determine_if_a_string_is_numeric b/Lang/Tcl/Determine_if_a_string_is_numeric new file mode 120000 index 0000000000..f672aaa0e7 --- /dev/null +++ b/Lang/Tcl/Determine_if_a_string_is_numeric @@ -0,0 +1 @@ +../../Task/Determine_if_a_string_is_numeric/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Forest_fire b/Lang/Tcl/Forest_fire new file mode 120000 index 0000000000..87b99506d4 --- /dev/null +++ b/Lang/Tcl/Forest_fire @@ -0,0 +1 @@ +../../Task/Forest_fire/Tcl \ No newline at end of file diff --git a/Task/Ackermann_function/0DESCRIPTION b/Task/Ackermann_function/0DESCRIPTION new file mode 100644 index 0000000000..c270cadb62 --- /dev/null +++ b/Task/Ackermann_function/0DESCRIPTION @@ -0,0 +1,12 @@ +The '''[[wp:Ackermann function|Ackermann function]]''' is a classic recursive example in computer science. It is a function that grows very quickly (in its value and in the size of its call tree). It is defined as follows: + +: A(m, n) = + \begin{cases} + n+1 & \mbox{if } m = 0 \\ + A(m-1, 1) & \mbox{if } m > 0 \mbox{ and } n = 0 \\ + A(m-1, A(m, n-1)) & \mbox{if } m > 0 \mbox{ and } n > 0. + \end{cases} + + + +Its arguments are never negative and it always terminates. Write a function which returns the value of A(m, n). Arbitrary precision is preferred (since the function grows so quickly), but not required. diff --git a/Task/Ackermann_function/1META.yaml b/Task/Ackermann_function/1META.yaml new file mode 100644 index 0000000000..890caf4e99 --- /dev/null +++ b/Task/Ackermann_function/1META.yaml @@ -0,0 +1,5 @@ +--- +category: +- Memoization +- Classic CS problems and programs +note: Recursion diff --git a/Task/Ackermann_function/AWK/ackermann_function.awk b/Task/Ackermann_function/AWK/ackermann_function.awk new file mode 100644 index 0000000000..91c20e0931 --- /dev/null +++ b/Task/Ackermann_function/AWK/ackermann_function.awk @@ -0,0 +1,18 @@ +function ackermann(m, n) +{ + if ( m == 0 ) { + return n+1 + } + if ( n == 0 ) { + return ackermann(m-1, 1) + } + return ackermann(m-1, ackermann(m, n-1)) +} + +BEGIN { + for(n=0; n < 7; n++) { + for(m=0; m < 4; m++) { + print "A(" m "," n ") = " ackermann(m,n) + } + } +} diff --git a/Task/Ackermann_function/ActionScript/ackermann_function.as b/Task/Ackermann_function/ActionScript/ackermann_function.as new file mode 100644 index 0000000000..0caa027f75 --- /dev/null +++ b/Task/Ackermann_function/ActionScript/ackermann_function.as @@ -0,0 +1,13 @@ +public function ackermann(m:uint, n:uint):uint +{ + if (m == 0) + { + return n + 1; + } + if (n == 0) + { + return ackermann(m - 1, 1); + } + + return ackermann(m - 1, ackermann(m, n - 1)); +} diff --git a/Task/Ackermann_function/BASIC/ackermann_function.bas b/Task/Ackermann_function/BASIC/ackermann_function.bas new file mode 100644 index 0000000000..cdd53f134e --- /dev/null +++ b/Task/Ackermann_function/BASIC/ackermann_function.bas @@ -0,0 +1,12 @@ +DECLARE FUNCTION ack! (m!, n!) + +FUNCTION ack (m!, n!) + IF m = 0 THEN ack = n + 1 + + IF m > 0 AND n = 0 THEN + ack = ack(m - 1, 1) + END IF + IF m > 0 AND n > 0 THEN + ack = ack(m - 1, ack(m, n - 1)) + END IF +END FUNCTION diff --git a/Task/Ackermann_function/Babel/ackermann_function.pb b/Task/Ackermann_function/Babel/ackermann_function.pb new file mode 100644 index 0000000000..4b841dfa87 --- /dev/null +++ b/Task/Ackermann_function/Babel/ackermann_function.pb @@ -0,0 +1,53 @@ +main: + {((0 0) (0 1) (0 2) + (0 3) (0 4) (1 0) + (1 1) (1 2) (1 3) + (1 4) (2 0) (2 1) + (2 2) (2 3) (3 0) + (3 1) (3 2) (4 0)) + + { dup + "A(" << { %d " " . << } ... ") = " << + reverse give + ack + %d cr << } ... } + +ack!: + { dup zero? + { <-> dup zero? + { <-> + cp + 1 - + <- <- 1 - -> + ack -> + ack } + { <-> + 1 - + <- 1 -> + ack } + if } + { zap 1 + } + if } + +zero?!: { 0 = } + +Output: + +A(0 0 ) = 1 +A(0 1 ) = 2 +A(0 2 ) = 3 +A(0 3 ) = 4 +A(0 4 ) = 5 +A(1 0 ) = 2 +A(1 1 ) = 3 +A(1 2 ) = 4 +A(1 3 ) = 5 +A(1 4 ) = 6 +A(2 0 ) = 3 +A(2 1 ) = 5 +A(2 2 ) = 7 +A(2 3 ) = 9 +A(3 0 ) = 5 +A(3 1 ) = 13 +A(3 2 ) = 29 +A(4 0 ) = 13 diff --git a/Task/Ackermann_function/Befunge/ackermann_function.bf b/Task/Ackermann_function/Befunge/ackermann_function.bf new file mode 100644 index 0000000000..8ac2939324 --- /dev/null +++ b/Task/Ackermann_function/Befunge/ackermann_function.bf @@ -0,0 +1,8 @@ +r[1&&{0 +>v + j +u>.@ +1> \:v +^ v:\_$1+ +\^v_$1\1- +u^>1-0fp:1-\0fg101- diff --git a/Task/Ackermann_function/C/ackermann_function-2.c b/Task/Ackermann_function/C/ackermann_function-2.c new file mode 100644 index 0000000000..4046392f61 --- /dev/null +++ b/Task/Ackermann_function/C/ackermann_function-2.c @@ -0,0 +1,41 @@ +#include +#include +#include + +int m_bits, n_bits; +int *cache; + +int ackermann(int m, int n) +{ + int idx, res; + if (!m) return n + 1; + + if (n >= 1< + +int ackermann(int m, int n) +{ + if (!m) return n + 1; + if (!n) return ackermann(m - 1, 1); + return ackermann(m - 1, ackermann(m, n - 1)); +} + +int main() +{ + int m, n; + for (m = 0; m <= 4; m++) + for (n = 0; n < 6 - m; n++) + printf("A(%d, %d) = %d\n", m, n, ackermann(m, n)); + + return 0; +} diff --git a/Task/Ackermann_function/Clojure/ackermann_function.clj b/Task/Ackermann_function/Clojure/ackermann_function.clj new file mode 100644 index 0000000000..ce8fd7c411 --- /dev/null +++ b/Task/Ackermann_function/Clojure/ackermann_function.clj @@ -0,0 +1,4 @@ +(defn ackermann [m n] + (cond (zero? m) (inc n) + (zero? n) (ackermann (dec m) 1) + :else (ackermann (dec m) (ackermann m (dec n))))) diff --git a/Task/Ackermann_function/CoffeeScript/ackermann_function.coffee b/Task/Ackermann_function/CoffeeScript/ackermann_function.coffee new file mode 100644 index 0000000000..760cf90e10 --- /dev/null +++ b/Task/Ackermann_function/CoffeeScript/ackermann_function.coffee @@ -0,0 +1,4 @@ +ackermann = (m, n) -> + if m is 0 then n + 1 + else if m > 0 and n is 0 then ackermann m - 1, 1 + else ackermann m - 1, ackermann m, n - 1 diff --git a/Task/Ackermann_function/Dylan/ackermann_function.dylan b/Task/Ackermann_function/Dylan/ackermann_function.dylan new file mode 100644 index 0000000000..6c79f966ba --- /dev/null +++ b/Task/Ackermann_function/Dylan/ackermann_function.dylan @@ -0,0 +1,6 @@ +define method ack(m == 0, n :: ) + n + 1 +end; +define method ack(m :: , n :: ) + ack(m - 1, if (n == 0) 1 else ack(m, n - 1) end) +end; diff --git a/Task/Ackermann_function/Eiffel/ackermann_function.e b/Task/Ackermann_function/Eiffel/ackermann_function.e new file mode 100644 index 0000000000..25a0bdd19a --- /dev/null +++ b/Task/Ackermann_function/Eiffel/ackermann_function.e @@ -0,0 +1,41 @@ +note + description: "Example of Ackerman function" + URI: "http://rosettacode.org/wiki/Ackermann_function" + +class + ACKERMAN_EXAMPLE + +create + make + +feature {NONE} -- Initialization + + make + do + print ("%N A(0,0):" + ackerman (0, 0).out) + print ("%N A(1,0):" + ackerman (1, 0).out) + print ("%N A(0,1):" + ackerman (0, 1).out) + print ("%N A(1,1):" + ackerman (1, 1).out) + print ("%N A(2,0):" + ackerman (2, 0).out) + print ("%N A(2,1):" + ackerman (2, 1).out) + print ("%N A(2,2):" + ackerman (2, 2).out) + print ("%N A(0,2):" + ackerman (0, 2).out) + print ("%N A(1,2):" + ackerman (1, 2).out) + print ("%N A(3,3):" + ackerman (3, 3).out) + print ("%N A(3,4):" + ackerman (3, 4).out) + end + +feature -- Access + + ackerman (m: NATURAL; n: NATURAL): NATURAL + do + if m = 0 then + Result := n + 1 + elseif m > 0 and n = 0 then + Result := ackerman (m - 1, 1) + elseif m > 0 and n > 0 then + Result := ackerman (m - 1, ackerman (m, n - 1)) + end + end + +end diff --git a/Task/Ackermann_function/Erlang/ackermann_function.erl b/Task/Ackermann_function/Erlang/ackermann_function.erl new file mode 100644 index 0000000000..d59d55aed7 --- /dev/null +++ b/Task/Ackermann_function/Erlang/ackermann_function.erl @@ -0,0 +1,11 @@ +-module(main). +-export([main/1]). + +main( [ A | [ B |[]]]) -> + io:fwrite("~p~n",[ack(toi(A),toi(B))]). + +toi(E) -> element(1,string:to_integer(E)). + +ack(0,N) -> N + 1; +ack(M,0) -> ack(M-1, 1); +ack(M,N) -> ack(M-1,ack(M,N-1)). diff --git a/Task/Ackermann_function/Forth/ackermann_function-2.fth b/Task/Ackermann_function/Forth/ackermann_function-2.fth new file mode 100644 index 0000000000..ecb84779b3 --- /dev/null +++ b/Task/Ackermann_function/Forth/ackermann_function-2.fth @@ -0,0 +1,14 @@ +: ackermann ( m n -- u ) + over ( case statement) + 0 over = if drop nip 1+ else + 1 over = if drop nip 2 + else + 2 over = if drop nip 2* 3 + else + 3 over = if drop swap 5 + swap lshift 3 - else + drop swap 1- swap dup + if + 1- over 1+ swap recurse recurse exit + else + 1+ recurse exit \ allow tail recursion + then + then then then then +; diff --git a/Task/Ackermann_function/Forth/ackermann_function.fth b/Task/Ackermann_function/Forth/ackermann_function.fth new file mode 100644 index 0000000000..a6e6c303b9 --- /dev/null +++ b/Task/Ackermann_function/Forth/ackermann_function.fth @@ -0,0 +1,5 @@ +: acker ( m n -- u ) + over 0= IF nip 1+ EXIT THEN + swap 1- swap ( m-1 n -- ) + dup 0= IF 1+ recurse EXIT THEN + 1- over 1+ swap recurse recurse ; diff --git a/Task/Ackermann_function/Fortran/ackermann_function.f b/Task/Ackermann_function/Fortran/ackermann_function.f new file mode 100644 index 0000000000..a58587772d --- /dev/null +++ b/Task/Ackermann_function/Fortran/ackermann_function.f @@ -0,0 +1,27 @@ +PROGRAM EXAMPLE + IMPLICIT NONE + + INTEGER :: i, j + + DO i = 0, 3 + DO j = 0, 6 + WRITE(*, "(I10)", ADVANCE="NO") Ackermann(i, j) + END DO + WRITE(*,*) + END DO + +CONTAINS + + RECURSIVE FUNCTION Ackermann(m, n) RESULT(ack) + INTEGER :: ack, m, n + + IF (m == 0) THEN + ack = n + 1 + ELSE IF (n == 0) THEN + ack = Ackermann(m - 1, 1) + ELSE + ack = Ackermann(m - 1, Ackermann(m, n - 1)) + END IF + END FUNCTION Ackermann + +END PROGRAM EXAMPLE diff --git a/Task/Ackermann_function/Go/ackermann_function-2.go b/Task/Ackermann_function/Go/ackermann_function-2.go new file mode 100644 index 0000000000..33271a6aaf --- /dev/null +++ b/Task/Ackermann_function/Go/ackermann_function-2.go @@ -0,0 +1,15 @@ +func Ackermann2(m, n uint) uint { + switch { + case m == 0: + return n + 1 + case m == 1: + return n + 2 + case m == 2: + return 2*n + 3 + case m == 3: + return 8 << n - 3 + case n == 0: + return Ackermann2(m - 1, 1) + } + return Ackermann2(m - 1, Ackermann2(m, n - 1)) +} diff --git a/Task/Ackermann_function/Go/ackermann_function-3.go b/Task/Ackermann_function/Go/ackermann_function-3.go new file mode 100644 index 0000000000..dafdf5cea5 --- /dev/null +++ b/Task/Ackermann_function/Go/ackermann_function-3.go @@ -0,0 +1,53 @@ +package main + +import ( + "fmt" + "math/big" + "unsafe" +) + +var one = big.NewInt(1) +var two = big.NewInt(2) +var three = big.NewInt(3) +var eight = big.NewInt(8) +var u uint +var uBits = int(unsafe.Sizeof(u))*8 - 1 + +func Ackermann2(m, n *big.Int) *big.Int { + if m.Cmp(three) <= 0 { + switch m.Int64() { + case 0: + return new(big.Int).Add(n, one) + case 1: + return new(big.Int).Add(n, two) + case 2: + r := new(big.Int).Lsh(n, 1) + return r.Add(r, three) + case 3: + if n.BitLen() > uBits { + panic("way too big") + } + r := new(big.Int).Lsh(eight, uint(n.Int64())) + return r.Sub(r, three) + } + } + if n.BitLen() == 0 { + return Ackermann2(new(big.Int).Sub(m, one), one) + } + return Ackermann2(new(big.Int).Sub(m, one), + Ackermann2(m, new(big.Int).Sub(n, one))) +} + +func main() { + show(0, 0) + show(1, 2) + show(2, 4) + show(3, 100) + show(4, 1) + show(4, 3) +} + +func show(m, n int64) { + fmt.Printf("A(%d, %d) = ", m, n) + fmt.Println(Ackermann2(big.NewInt(m), big.NewInt(n))) +} diff --git a/Task/Ackermann_function/Go/ackermann_function.go b/Task/Ackermann_function/Go/ackermann_function.go new file mode 100644 index 0000000000..ea2c7a2614 --- /dev/null +++ b/Task/Ackermann_function/Go/ackermann_function.go @@ -0,0 +1,9 @@ +func Ackermann(m, n uint) uint { + switch { + case m == 0: + return n + 1 + case n == 0: + return Ackermann(m - 1, 1) + } + return Ackermann(m - 1, Ackermann(m, n - 1)) +} diff --git a/Task/Ackermann_function/Haskell/ackermann_function-2.hs b/Task/Ackermann_function/Haskell/ackermann_function-2.hs new file mode 100644 index 0000000000..25b4cbf489 --- /dev/null +++ b/Task/Ackermann_function/Haskell/ackermann_function-2.hs @@ -0,0 +1,9 @@ +-- everything here are [Int] or [[Int]], which would overflow +-- * had it not overrun the stack first * +ackermann = iterate ack [1..] where + ack a = s where + s = a!!1 : f (tail a) (zipWith (-) s (1:s)) + f a (b:bs) = (head aa) : f aa bs where + aa = drop b a + +main = mapM_ print $ map (\n -> take (6 - n) $ ackermann !! n) [0..5] diff --git a/Task/Ackermann_function/Haskell/ackermann_function.hs b/Task/Ackermann_function/Haskell/ackermann_function.hs new file mode 100644 index 0000000000..53f36fffb1 --- /dev/null +++ b/Task/Ackermann_function/Haskell/ackermann_function.hs @@ -0,0 +1,3 @@ +ack 0 n = n + 1 +ack m 0 = ack (m-1) 1 +ack m n = ack (m-1) (ack m (n-1)) diff --git a/Task/Ackermann_function/Java/ackermann_function.java b/Task/Ackermann_function/Java/ackermann_function.java new file mode 100644 index 0000000000..55feb01b0a --- /dev/null +++ b/Task/Ackermann_function/Java/ackermann_function.java @@ -0,0 +1,8 @@ +import java.math.BigInteger; + +public static BigInteger ack(BigInteger m, BigInteger n) { + return m.equals(BigInteger.ZERO) + ? n.add(BigInteger.ONE) + : ack(m.subtract(BigInteger.ONE), + n.equals(BigInteger.ZERO) ? BigInteger.ONE : ack(m, n.subtract(BigInteger.ONE))); +} diff --git a/Task/Ackermann_function/JavaScript/ackermann_function.js b/Task/Ackermann_function/JavaScript/ackermann_function.js new file mode 100644 index 0000000000..8b07754850 --- /dev/null +++ b/Task/Ackermann_function/JavaScript/ackermann_function.js @@ -0,0 +1,4 @@ +function ack(m, n) +{ + return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1)); +} diff --git a/Task/Ackermann_function/Lua/ackermann_function.lua b/Task/Ackermann_function/Lua/ackermann_function.lua new file mode 100644 index 0000000000..39e54d9b1c --- /dev/null +++ b/Task/Ackermann_function/Lua/ackermann_function.lua @@ -0,0 +1,5 @@ +function ack(M,N) + if M == 0 then return N + 1 end + if N == 0 then return ack(M-1,1) end + return ack(M-1,ack(M, N-1)) +end diff --git a/Task/Ackermann_function/PHP/ackermann_function.php b/Task/Ackermann_function/PHP/ackermann_function.php new file mode 100644 index 0000000000..80bde22702 --- /dev/null +++ b/Task/Ackermann_function/PHP/ackermann_function.php @@ -0,0 +1,15 @@ +function ackermann( $m , $n ) +{ + if ( $m==0 ) + { + return $n + 1; + } + elseif ( $n==0 ) + { + return ackermann( $m-1 , 1 ); + } + return ackermann( $m-1, ackermann( $m , $n-1 ) ); +} + +echo ackermann( 3, 4 ); +// prints 125 diff --git a/Task/Ackermann_function/Perl/ackermann_function-2.pl b/Task/Ackermann_function/Perl/ackermann_function-2.pl new file mode 100644 index 0000000000..170af44845 --- /dev/null +++ b/Task/Ackermann_function/Perl/ackermann_function-2.pl @@ -0,0 +1,6 @@ +sub A { + my ($m, $n) = @_; + if ($m == 0) { $n + 1 } + elsif ($n == 0) { A($m - 1, 1) } + else { A($m - 1, A($m, $n - 1)) } +} diff --git a/Task/Ackermann_function/Perl/ackermann_function-3.pl b/Task/Ackermann_function/Perl/ackermann_function-3.pl new file mode 100644 index 0000000000..72fc9acaf6 --- /dev/null +++ b/Task/Ackermann_function/Perl/ackermann_function-3.pl @@ -0,0 +1,6 @@ +sub A { + my ($m, $n) = @_; + $m == 0 ? $n + 1 : + $n == 0 ? A($m - 1, 1) : + A($m - 1, A($m, $n - 1)) +} diff --git a/Task/Ackermann_function/Perl/ackermann_function.pl b/Task/Ackermann_function/Perl/ackermann_function.pl new file mode 100644 index 0000000000..8ff2769053 --- /dev/null +++ b/Task/Ackermann_function/Perl/ackermann_function.pl @@ -0,0 +1,13 @@ +{ + my @memo; + sub A { + my( $m, $n ) = @_; + $memo[ $m ][ $n ] and return $memo[ $m ][ $n ]; + $m or return $n + 1; + return $memo[ $m ][ $n ] = ( + $n + ? A( $m - 1, A( $m, $n - 1 ) ) + : A( $m - 1, 1 ) + ); + } +} diff --git a/Task/Ackermann_function/PicoLisp/ackermann_function.l b/Task/Ackermann_function/PicoLisp/ackermann_function.l new file mode 100644 index 0000000000..e16bd5a491 --- /dev/null +++ b/Task/Ackermann_function/PicoLisp/ackermann_function.l @@ -0,0 +1,5 @@ +(de ack (X Y) + (cond + ((=0 X) (inc Y)) + ((=0 Y) (ack (dec X) 1)) + (T (ack (dec X) (ack X (dec Y)))) ) ) diff --git a/Task/Ackermann_function/Prolog/ackermann_function.pro b/Task/Ackermann_function/Prolog/ackermann_function.pro new file mode 100644 index 0000000000..73d8af0421 --- /dev/null +++ b/Task/Ackermann_function/Prolog/ackermann_function.pro @@ -0,0 +1,3 @@ +ack(0, N, Ans) :- Ans is N+1. +ack(M, 0, Ans) :- M>0, X is M-1, ack(X, 1, Ans). +ack(M, N, Ans) :- M>0, N>0, X is M-1, Y is N-1, ack(M, Y, Ans2), ack(X, Ans2, Ans). diff --git a/Task/Ackermann_function/Python/ackermann_function-2.py b/Task/Ackermann_function/Python/ackermann_function-2.py new file mode 100644 index 0000000000..0245d4e659 --- /dev/null +++ b/Task/Ackermann_function/Python/ackermann_function-2.py @@ -0,0 +1,7 @@ +def ack2(M, N): + if M == 0: + return N + 1 + elif N == 0: + return ack1(M - 1, 1) + else: + return ack1(M - 1, ack1(M, N - 1)) diff --git a/Task/Ackermann_function/Python/ackermann_function-3.py b/Task/Ackermann_function/Python/ackermann_function-3.py new file mode 100644 index 0000000000..a3a6d3d33d --- /dev/null +++ b/Task/Ackermann_function/Python/ackermann_function-3.py @@ -0,0 +1,10 @@ +>>> import sys +>>> sys.setrecursionlimit(3000) +>>> ack1(0,0) +1 +>>> ack1(3,4) +125 +>>> ack2(0,0) +1 +>>> ack2(3,4) +125 diff --git a/Task/Ackermann_function/Python/ackermann_function-4.py b/Task/Ackermann_function/Python/ackermann_function-4.py new file mode 100644 index 0000000000..a8279d05d7 --- /dev/null +++ b/Task/Ackermann_function/Python/ackermann_function-4.py @@ -0,0 +1,6 @@ +def ack2(M, N): + return (N + 1) if M == 0 else ( + (N + 2) if M == 1 else ( + (2*N + 3) if M == 2 else ( + (8*(2**N - 1) + 5) if M == 3 else ( + ack2(M-1, 1) if N == 0 else ack2(M-1, ack2(M, N-1)))))) diff --git a/Task/Ackermann_function/Python/ackermann_function.py b/Task/Ackermann_function/Python/ackermann_function.py new file mode 100644 index 0000000000..6e11eb7085 --- /dev/null +++ b/Task/Ackermann_function/Python/ackermann_function.py @@ -0,0 +1,3 @@ +def ack1(M, N): + return (N + 1) if M == 0 else ( + ack1(M-1, 1) if N == 0 else ack1(M-1, ack1(M, N-1))) diff --git a/Task/Ackermann_function/R/ackermann_function-2.r b/Task/Ackermann_function/R/ackermann_function-2.r new file mode 100644 index 0000000000..300d6c4294 --- /dev/null +++ b/Task/Ackermann_function/R/ackermann_function-2.r @@ -0,0 +1,3 @@ +for ( i in 0:3 ) { + print(ackermann(i, 4)) +} diff --git a/Task/Ackermann_function/R/ackermann_function.r b/Task/Ackermann_function/R/ackermann_function.r new file mode 100644 index 0000000000..60c879ae66 --- /dev/null +++ b/Task/Ackermann_function/R/ackermann_function.r @@ -0,0 +1,9 @@ +ackermann <- function(m, n) { + if ( m == 0 ) { + n+1 + } else if ( n == 0 ) { + ackermann(m-1, 1) + } else { + ackermann(m-1, ackermann(m, n-1)) + } +} diff --git a/Task/Ackermann_function/REXX/ackermann_function-2.rexx b/Task/Ackermann_function/REXX/ackermann_function-2.rexx new file mode 100644 index 0000000000..1fa0d343da --- /dev/null +++ b/Task/Ackermann_function/REXX/ackermann_function-2.rexx @@ -0,0 +1,21 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ +high=24 + do j=0 to 3; say + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,10) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if n==0 then return ackermann(m-1,1) +if m==2 then return n*2+3 + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann_function/REXX/ackermann_function-3.rexx b/Task/Ackermann_function/REXX/ackermann_function-3.rexx new file mode 100644 index 0000000000..a81e1f2108 --- /dev/null +++ b/Task/Ackermann_function/REXX/ackermann_function-3.rexx @@ -0,0 +1,36 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ +high=24 +numeric digits 100 /*have REXX to use up to 100 digit integers.*/ + + /*When REXX raises a number to a power (via */ + /* the ** operator), the power must be an */ + /* integer (positive, zero, or negative). */ + + do j=0 to 4; say /*Ackermann(5,1) is a bit impractical to calc.*/ + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + if j==4 & k==2 then leave /*no sense in going overboard.*/ + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,10) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if m==1 then return n+2 +if m==2 then return n+n+3 +if m==3 then return 2**(n+3)-3 +if m==4 then do; a=2 + do (n+3)-1 /*ugh!*/ + a=2**a + end + return a-3 + end +if n==0 then return ackermann(m-1,1) + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann_function/REXX/ackermann_function.rexx b/Task/Ackermann_function/REXX/ackermann_function.rexx new file mode 100644 index 0000000000..229351ed1f --- /dev/null +++ b/Task/Ackermann_function/REXX/ackermann_function.rexx @@ -0,0 +1,25 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ + + /*Note: the Ackermann function (as implemented) is */ + /* higly recursive and is limited by the */ + /* biggest number that can have "1" added to */ + /* a number (successfully, accurately). */ +high=24 + do j=0 to 3; say + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,high) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if n==0 then return ackermann(m-1,1) + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann_function/Racket/ackermann_function.rkt b/Task/Ackermann_function/Racket/ackermann_function.rkt new file mode 100644 index 0000000000..554373d035 --- /dev/null +++ b/Task/Ackermann_function/Racket/ackermann_function.rkt @@ -0,0 +1,7 @@ +#lang racket +(define (ackermann m n) + (cond [(zero? m) (add1 n)] + [(and (> m 0) (zero? n)) + (ackermann (sub1 m) 1)] + [(and (> m 0) (> n 0)) + (ackermann (sub1 m) (ackermann m (sub1 n)))])) diff --git a/Task/Ackermann_function/Ruby/ackermann_function-2.rb b/Task/Ackermann_function/Ruby/ackermann_function-2.rb new file mode 100644 index 0000000000..15994be3e6 --- /dev/null +++ b/Task/Ackermann_function/Ruby/ackermann_function-2.rb @@ -0,0 +1,4 @@ +(0..3).each do |m| + (0..6).each { |n| print ack(m, n), ' ' } + puts +end diff --git a/Task/Ackermann_function/Ruby/ackermann_function.rb b/Task/Ackermann_function/Ruby/ackermann_function.rb new file mode 100644 index 0000000000..b60f0d44e9 --- /dev/null +++ b/Task/Ackermann_function/Ruby/ackermann_function.rb @@ -0,0 +1,9 @@ +def ack(m, n) + if m == 0 + n + 1 + elsif n == 0 + ack(m-1, 1) + else + ack(m-1, ack(m, n-1)) + end +end diff --git a/Task/Ackermann_function/SNUSP/ackermann_function.snusp b/Task/Ackermann_function/SNUSP/ackermann_function.snusp new file mode 100644 index 0000000000..c85c68fd75 --- /dev/null +++ b/Task/Ackermann_function/SNUSP/ackermann_function.snusp @@ -0,0 +1,12 @@ + /==!/==atoi=@@@-@-----# + | | Ackermann function + | | /=========\!==\!====\ recursion: +$,@/>,@/==ack=!\?\<+# | | | A(0,j) -> j+1 + j i \-@/# | | A(i,0) -> A(i-1,1) + \@\>@\->@/@\<-@/# A(i,j) -> A(i-1,A(i,j-1)) + | | | + # # | | | /+<<<-\ + /-<<+>>\!=/ \=====|==!/========?\>>>=?/<<# + ? ? | \<<<+>+>>-/ + \>>+<<-/!==========/ + # # diff --git a/Task/Ackermann_function/Sather/ackermann_function-2.sa b/Task/Ackermann_function/Sather/ackermann_function-2.sa new file mode 100644 index 0000000000..bdbd3d2f3e --- /dev/null +++ b/Task/Ackermann_function/Sather/ackermann_function-2.sa @@ -0,0 +1,19 @@ +class MAIN is + + ackermann(m, n:INTI):INTI is + zero ::= 0.inti; -- to avoid type conversion each time + one ::= 1.inti; + if m = zero then return n + one; end; + if n = zero then return ackermann(m-one, one); end; + return ackermann(m-one, ackermann(m, n-one)); + end; + + main is + n, m :INT; + loop n := 0.upto!(6); + loop m := 0.upto!(3); + #OUT + "A(" + m + ", " + n + ") = " + ackermann(m.inti, n.inti) + "\n"; + end; + end; + end; +end; diff --git a/Task/Ackermann_function/Sather/ackermann_function.sa b/Task/Ackermann_function/Sather/ackermann_function.sa new file mode 100644 index 0000000000..035f9ab382 --- /dev/null +++ b/Task/Ackermann_function/Sather/ackermann_function.sa @@ -0,0 +1,19 @@ +class MAIN is + + ackermann(m, n:INT):INT + pre m >= 0 and n >= 0 + is + if m = 0 then return n + 1; end; + if n = 0 then return ackermann(m-1, 1); end; + return ackermann(m-1, ackermann(m, n-1)); + end; + + main is + n, m :INT; + loop n := 0.upto!(6); + loop m := 0.upto!(3); + #OUT + "A(" + m + ", " + n + ") = " + ackermann(m, n) + "\n"; + end; + end; + end; +end; diff --git a/Task/Ackermann_function/Scala/ackermann_function-2.scala b/Task/Ackermann_function/Scala/ackermann_function-2.scala new file mode 100644 index 0000000000..7c2af8c321 --- /dev/null +++ b/Task/Ackermann_function/Scala/ackermann_function-2.scala @@ -0,0 +1,2 @@ +scala> for ( m <- 0 to 3; n <- 0 to 6 ) yield ack(m,n) +res0: Seq.Projection[BigInt] = RangeG(1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8, 3, 5, 7, 9, 11, 13, 15, 5, 13, 29, 61, 125, 253, 509) diff --git a/Task/Ackermann_function/Scala/ackermann_function-3.scala b/Task/Ackermann_function/Scala/ackermann_function-3.scala new file mode 100644 index 0000000000..569da392e8 --- /dev/null +++ b/Task/Ackermann_function/Scala/ackermann_function-3.scala @@ -0,0 +1,40 @@ +val maxDepth = 4 + +val ackMMap = scala.collection.mutable.Map[BigInt, BigInt]() +val ackNMaps = Array.fill(maxDepth + 1) { scala.collection.mutable.Map[BigInt, BigInt]() } + +def ack(m: Int, n: BigInt): BigInt = { + if ((m < 0) || (n < 0)) { + throw new Exception("Negative parameters are not allowed: ack(%s, %s)".format(m, n)) + } + if (m > maxDepth) { + throw new Exception("First parameter is greater as %s: ack(%s, %s)".format(maxDepth, m, n)) + } + + val newM = m - 1 + val newN = n - 1 + + if (m == 0) { + n + 1 + } else if (n == 0) { + ackMMap.getOrElseUpdate(newM, ack(newM, 1)) + } else { + val createStep = 125 + val index = m + val mapCurrent = ackNMaps(index) + val mapPrevious = ackNMaps(index - 1) + val maxRecursion = 2 * createStep + val nrOfElements : BigInt = if (mapCurrent.isEmpty) 0 else mapCurrent.max._1 + + if ((nrOfElements + maxRecursion) < n) { + for (i <- nrOfElements + createStep to n by createStep) { + mapCurrent.getOrElseUpdate(i, ack(m, i)) + } + } + mapCurrent.getOrElseUpdate(n, { + val ackVal = mapCurrent.getOrElseUpdate(newN, ack(m, newN)) + + mapPrevious.getOrElseUpdate(ackVal, ack(newM, ackVal)) + }) + } +} diff --git a/Task/Ackermann_function/Scala/ackermann_function-4.scala b/Task/Ackermann_function/Scala/ackermann_function-4.scala new file mode 100644 index 0000000000..4f35e77f97 --- /dev/null +++ b/Task/Ackermann_function/Scala/ackermann_function-4.scala @@ -0,0 +1,5 @@ + if ((nrOfElements + maxRecursion) < n) { + for (i <- nrOfElements + createStep to n by createStep) { + mapCurrent.getOrElseUpdate(i, ack(m, i)) + } + } diff --git a/Task/Ackermann_function/Scala/ackermann_function.scala b/Task/Ackermann_function/Scala/ackermann_function.scala new file mode 100644 index 0000000000..c2886c2fb2 --- /dev/null +++ b/Task/Ackermann_function/Scala/ackermann_function.scala @@ -0,0 +1,5 @@ +def ack(m: BigInt, n: BigInt): BigInt = { + if (m==0) n+1 + else if (n==0) ack(m-1, 1) + else ack(m-1, ack(m, n-1)) +} diff --git a/Task/Ackermann_function/Scheme/ackermann_function.ss b/Task/Ackermann_function/Scheme/ackermann_function.ss new file mode 100644 index 0000000000..0df3c1c4da --- /dev/null +++ b/Task/Ackermann_function/Scheme/ackermann_function.ss @@ -0,0 +1,5 @@ +(define (A m n) + (cond + ((= m 0) (+ n 1)) + ((= n 0) (A (- m 1) 1)) + (else (A (- m 1) (A m (- n 1)))))) diff --git a/Task/Ackermann_function/Smalltalk/ackermann_function.st b/Task/Ackermann_function/Smalltalk/ackermann_function.st new file mode 100644 index 0000000000..382b2e3f34 --- /dev/null +++ b/Task/Ackermann_function/Smalltalk/ackermann_function.st @@ -0,0 +1,15 @@ +|ackermann| +ackermann := [ :n :m | + (n = 0) ifTrue: [ (m + 1) ] + ifFalse: [ + (m = 0) ifTrue: [ ackermann value: (n-1) value: 1 ] + ifFalse: [ + ackermann value: (n-1) + value: ( ackermann value: n + value: (m-1) ) + ] + ] +]. + +(ackermann value: 0 value: 0) displayNl. +(ackermann value: 3 value: 4) displayNl. diff --git a/Task/Ackermann_function/Tcl/ackermann_function-2.tcl b/Task/Ackermann_function/Tcl/ackermann_function-2.tcl new file mode 100644 index 0000000000..f04087533c --- /dev/null +++ b/Task/Ackermann_function/Tcl/ackermann_function-2.tcl @@ -0,0 +1,9 @@ +proc ack {m n} { + if {$m == 0} { + expr {$n + 1} + } elseif {$n == 0} { + tailcall ack [expr {$m - 1}] 1 + } else { + tailcall ack [expr {$m - 1}] [ack $m [expr {$n - 1}]] + } +} diff --git a/Task/Ackermann_function/Tcl/ackermann_function-3.tcl b/Task/Ackermann_function/Tcl/ackermann_function-3.tcl new file mode 100644 index 0000000000..8e8a89ced6 --- /dev/null +++ b/Task/Ackermann_function/Tcl/ackermann_function-3.tcl @@ -0,0 +1,55 @@ +package require Tcl 8.6 + +# A memoization engine, from http://wiki.tcl.tk/18152 +oo::class create cache { + filter Memoize + variable ValueCache + method Memoize args { + # Do not filter the core method implementations + if {[lindex [self target] 0] eq "::oo::object"} { + return [next {*}$args] + } + + # Check if the value is already in the cache + set key [self target],$args + if {[info exist ValueCache($key)]} { + return $ValueCache($key) + } + + # Compute value, insert into cache, and return it + return [set ValueCache($key) [next {*}$args]] + } + method flushCache {} { + unset ValueCache + # Skip the cacheing + return -level 2 "" + } +} + +# Make an object, attach the cache engine to it, and define ack as a method +oo::object create cached +oo::objdefine cached { + mixin cache + method ack {m n} { + if {$m==0} { + expr {$n+1} + } elseif {$m==1} { + # From the Mathematica version + expr {$m+2} + } elseif {$m==2} { + # From the Mathematica version + expr {2*$n+3} + } elseif {$m==3} { + # From the Mathematica version + expr {8*(2**$n-1)+5} + } elseif {$n==0} { + tailcall my ack [expr {$m-1}] 1 + } else { + tailcall my ack [expr {$m-1}] [my ack $m [expr {$n-1}]] + } + } +} + +# Some small tweaks... +interp recursionlimit {} 100000 +interp alias {} ack {} cacheable ack diff --git a/Task/Ackermann_function/Tcl/ackermann_function.tcl b/Task/Ackermann_function/Tcl/ackermann_function.tcl new file mode 100644 index 0000000000..e48b4a59e9 --- /dev/null +++ b/Task/Ackermann_function/Tcl/ackermann_function.tcl @@ -0,0 +1,9 @@ +proc ack {m n} { + if {$m == 0} { + expr {$n + 1} + } elseif {$n == 0} { + ack [expr {$m - 1}] 1 + } else { + ack [expr {$m - 1}] [ack $m [expr {$n - 1}]] + } +} diff --git a/Task/Arrays/0DESCRIPTION b/Task/Arrays/0DESCRIPTION new file mode 100644 index 0000000000..86eaa73a1b --- /dev/null +++ b/Task/Arrays/0DESCRIPTION @@ -0,0 +1,13 @@ +This task is about arrays. For hashes or associative arrays, please +see [[Creating an Associative Array]]. + +In this task, the goal is to show basic array syntax in your +language. Basically, create an array, assign a value to it, and +retrieve an element. (if available, show both fixed-length arrays and +dynamic arrays, pushing a value into it.) + +Please discuss at Village Pump: {{vp|Arrays}}. Please merge code in from obsolete tasks [[Creating an Array]], [[Assigning Values to an Array]], and [[Retrieving an Element of an Array]]. + +'''See also''' +* [[Collections]] +* [[Two-dimensional array (runtime)]] diff --git a/Task/Arrays/1META.yaml b/Task/Arrays/1META.yaml new file mode 100644 index 0000000000..659c8686af --- /dev/null +++ b/Task/Arrays/1META.yaml @@ -0,0 +1,2 @@ +--- +note: Basic language learning diff --git a/Task/Arrays/AWK/arrays.awk b/Task/Arrays/AWK/arrays.awk new file mode 100644 index 0000000000..78c2916a8e --- /dev/null +++ b/Task/Arrays/AWK/arrays.awk @@ -0,0 +1,30 @@ +BEGIN { + # to make an array, assign elements to it + array[1] = "first" + array[2] = "second" + array[3] = "third" + alen = 3 # want the length? store in separate variable + + # or split a string + plen = split("2 3 5 7 11 13 17 19 23 29", primes) + clen = split("Ottawa;Washington DC;Mexico City", cities, ";") + + # retrieve an element + print "The 6th prime number is " primes[6] + + # push an element + cities[clen += 1] = "New York" + + dump("An array", array, alen) + dump("Some primes", primes, plen) + dump("A list of cities", cities, clen) +} + +function dump(what, array, len, i) { + print what; + + # iterate an array in order + for (i = 1; i <= len; i++) { + print " " i ": " array[i] + } +} diff --git a/Task/Arrays/ActionScript/arrays.as b/Task/Arrays/ActionScript/arrays.as new file mode 100644 index 0000000000..dd7c855b5a --- /dev/null +++ b/Task/Arrays/ActionScript/arrays.as @@ -0,0 +1,16 @@ +//creates an array of length 10 +var array1:Array = new Array(10); +//creates an array with the values 1, 2 +var array2:Array = new Array(1,2); +//arrays can also be set using array literals +var array3:Array = ["foo", "bar"]; +//to resize an array, modify the length property +array2.length = 3; +//arrays can contain objects of multiple types. +array2[2] = "Hello"; +//get a value from an array +trace(array2[2]); +//append a value to an array +array2.push(4); +//get and remove the last element of an array +trace(array2.pop()); diff --git a/Task/Arrays/BASIC/arrays-2.bas b/Task/Arrays/BASIC/arrays-2.bas new file mode 100644 index 0000000000..d5d3753f45 --- /dev/null +++ b/Task/Arrays/BASIC/arrays-2.bas @@ -0,0 +1 @@ + DIM myArray(-10 TO 10) AS INTEGER diff --git a/Task/Arrays/BASIC/arrays-3.bas b/Task/Arrays/BASIC/arrays-3.bas new file mode 100644 index 0000000000..c067970d3c --- /dev/null +++ b/Task/Arrays/BASIC/arrays-3.bas @@ -0,0 +1,6 @@ + 'Specify that the array is dynamic and not static: + '$DYNAMIC + DIM SHARED myArray(-10 TO 10, 10 TO 30) AS STRING + REDIM SHARED myArray(20, 20) AS STRING + myArray(1,1) = "Item1" + myArray(1,2) = "Item2" diff --git a/Task/Arrays/BASIC/arrays-4.bas b/Task/Arrays/BASIC/arrays-4.bas new file mode 100644 index 0000000000..2ab75d1c01 --- /dev/null +++ b/Task/Arrays/BASIC/arrays-4.bas @@ -0,0 +1,6 @@ + DIM month$(12) + DATA January, February, March, April, May, June, July + DATA August, September, October, November, December + FOR m=1 TO 12 + READ month$(m) + NEXT m diff --git a/Task/Arrays/BASIC/arrays-5.bas b/Task/Arrays/BASIC/arrays-5.bas new file mode 100644 index 0000000000..79bbfc2f3d --- /dev/null +++ b/Task/Arrays/BASIC/arrays-5.bas @@ -0,0 +1 @@ + Dim myArray(1 To 2, 1 To 5) As Integer => {{1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}} diff --git a/Task/Arrays/BASIC/arrays-6.bas b/Task/Arrays/BASIC/arrays-6.bas new file mode 100644 index 0000000000..90624d243b --- /dev/null +++ b/Task/Arrays/BASIC/arrays-6.bas @@ -0,0 +1,7 @@ +10 REM TRANSLATION OF QBASIC STATIC VERSION +20 REM ELEMENT NUMBERS TRADITIONALLY START AT ONE +30 DIM A%(11): REM ARRAY OF ELEVEN INTEGER ELEMENTS +40 LET A%(1) = -1 +50 LET A%(11) = 1 +60 PRINT A%(1), A%(11) +70 END diff --git a/Task/Arrays/BASIC/arrays-7.bas b/Task/Arrays/BASIC/arrays-7.bas new file mode 100644 index 0000000000..aa84cb10bf --- /dev/null +++ b/Task/Arrays/BASIC/arrays-7.bas @@ -0,0 +1,6 @@ +DIM staticArray(10) AS INTEGER + +staticArray(0) = -1 +staticArray(10) = 1 + +PRINT staticArray(0), staticArray(10) diff --git a/Task/Arrays/BASIC/arrays-8.bas b/Task/Arrays/BASIC/arrays-8.bas new file mode 100644 index 0000000000..fe19328a03 --- /dev/null +++ b/Task/Arrays/BASIC/arrays-8.bas @@ -0,0 +1,9 @@ +REDIM dynamicArray(10) AS INTEGER + +dynamicArray(0) = -1 +PRINT dynamicArray(0) + +REDIM dynamicArray(20) + +dynamicArray(20) = 1 +PRINT dynamicArray(0), dynamicArray(20) diff --git a/Task/Arrays/BASIC/arrays.bas b/Task/Arrays/BASIC/arrays.bas new file mode 100644 index 0000000000..0f421ab4f0 --- /dev/null +++ b/Task/Arrays/BASIC/arrays.bas @@ -0,0 +1,2 @@ + OPTION BASE 1 + DIM myArray(100) AS INTEGER diff --git a/Task/Arrays/C/arrays-2.c b/Task/Arrays/C/arrays-2.c new file mode 100644 index 0000000000..29f0ffc380 --- /dev/null +++ b/Task/Arrays/C/arrays-2.c @@ -0,0 +1 @@ +#define MYFLOAT_SIZE (sizeof(myFloats)/sizeof(myFloats[0])) diff --git a/Task/Arrays/C/arrays-3.c b/Task/Arrays/C/arrays-3.c new file mode 100644 index 0000000000..b613d9538c --- /dev/null +++ b/Task/Arrays/C/arrays-3.c @@ -0,0 +1,5 @@ +long a2D_Array[3][5]; /* 3 rows, 5 columns. */ +float my2Dfloats[][3] = { + 1.0, 2.0, 0.0, + 5.0, 1.0, 3.0 }; +#define FLOAT_ROWS (sizeof(my2Dfloats)/sizeof(my2dFloats[0])) diff --git a/Task/Arrays/C/arrays-4.c b/Task/Arrays/C/arrays-4.c new file mode 100644 index 0000000000..abc3b5f654 --- /dev/null +++ b/Task/Arrays/C/arrays-4.c @@ -0,0 +1,11 @@ +int numElements = 10; +int *myArray = malloc(sizeof(int) * numElements); /* array of 10 integers */ +if ( myArray != NULL ) /* check to ensure allocation succeeded. */ +{ + /* allocation succeeded */ + /* at the end, we need to free the allocated memory */ + free(myArray); +} + /* calloc() additionally pre-initializes to all zeros */ +short *myShorts = calloc( numElements, sizeof(short)); /* array of 10 */ +if (myShorts != NULL).... diff --git a/Task/Arrays/C/arrays-5.c b/Task/Arrays/C/arrays-5.c new file mode 100644 index 0000000000..4ef124f46f --- /dev/null +++ b/Task/Arrays/C/arrays-5.c @@ -0,0 +1,2 @@ +myArray[0] = 1; +myArray[1] = 3; diff --git a/Task/Arrays/C/arrays-6.c b/Task/Arrays/C/arrays-6.c new file mode 100644 index 0000000000..3e40b6c623 --- /dev/null +++ b/Task/Arrays/C/arrays-6.c @@ -0,0 +1 @@ +printf("%d\n", myArray[1]); diff --git a/Task/Arrays/C/arrays-7.c b/Task/Arrays/C/arrays-7.c new file mode 100644 index 0000000000..7413d69bb8 --- /dev/null +++ b/Task/Arrays/C/arrays-7.c @@ -0,0 +1,3 @@ +*(array + index) = 1; +printf("%d\n", *(array + index)); +3[array] = 5; diff --git a/Task/Arrays/C/arrays-8.c b/Task/Arrays/C/arrays-8.c new file mode 100644 index 0000000000..2fd659dfb0 --- /dev/null +++ b/Task/Arrays/C/arrays-8.c @@ -0,0 +1,10 @@ +#define XSIZE 20 +double *kernel = malloc(sizeof(double)*2*XSIZE+1); +if (kernel) { + kernel += XSIZE; + for (ix=-XSIZE; ix<=XSIZE; ix++) { + kernel[ix] = f(ix); + .... + free(kernel-XSIZE); + } +} diff --git a/Task/Arrays/C/arrays-9.c b/Task/Arrays/C/arrays-9.c new file mode 100644 index 0000000000..97abdb672a --- /dev/null +++ b/Task/Arrays/C/arrays-9.c @@ -0,0 +1,3 @@ +int *array = malloc (sizeof(int) * 20); +.... +array = realloc(array, sizeof(int) * 40); diff --git a/Task/Arrays/C/arrays.c b/Task/Arrays/C/arrays.c new file mode 100644 index 0000000000..52409e7fec --- /dev/null +++ b/Task/Arrays/C/arrays.c @@ -0,0 +1,2 @@ +int myArray2[10] = { 1, 2, 0 }; /* the rest of elements get the value 0 */ +float myFloats[] ={1.2, 2.5, 3.333, 4.92, 11.2, 22.0 }; /* automatically sizes */ diff --git a/Task/Arrays/Clojure/arrays.clj b/Task/Arrays/Clojure/arrays.clj new file mode 100644 index 0000000000..819f9c8549 --- /dev/null +++ b/Task/Arrays/Clojure/arrays.clj @@ -0,0 +1,34 @@ +;clojure is a language built with immutable/persistent data structures. there is no concept of changing what a vector/list +;is, instead clojure creates a new array with an added value using (conj...) +;in the example below the my-list does not change. + + +user=> (def my-list (list 1 2 3 4 5)) + +user=> my-list +(1 2 3 4 5) + +user=> (first my-list) +1 + +user=> (nth my-list 3) +4 + +user=> (conj my-list 100) ;adding to a list always adds to the head of the list +(100 1 2 3 4 5) + +user=> my-list ;it is impossible to change the list pointed to by my-list +(1 2 3 4 5) + +user=> (def my-new-list (conj my-list 100)) + +user=> my-new-list +(100 1 2 3 4 5) + +user=> (cons 200 my-new-list) ;(cons makes a new list, (conj will make a new object of the same type as the one it is given +(200 100 1 2 3 4 5) + +user=> (def my-vec [1 2 3 4 5 6]) + +user=> (conj my-vec 300) ;adding to a vector always adds to the end of the vector +[1 2 3 4 5 6 300] diff --git a/Task/Arrays/CoffeeScript/arrays-2.coffee b/Task/Arrays/CoffeeScript/arrays-2.coffee new file mode 100644 index 0000000000..3e5facdbce --- /dev/null +++ b/Task/Arrays/CoffeeScript/arrays-2.coffee @@ -0,0 +1 @@ + diff --git a/Task/Arrays/CoffeeScript/arrays-3.coffee b/Task/Arrays/CoffeeScript/arrays-3.coffee new file mode 100644 index 0000000000..6d9de17cfa --- /dev/null +++ b/Task/Arrays/CoffeeScript/arrays-3.coffee @@ -0,0 +1,3 @@ + + arr2 = ArrayNew(2); + diff --git a/Task/Arrays/CoffeeScript/arrays.coffee b/Task/Arrays/CoffeeScript/arrays.coffee new file mode 100644 index 0000000000..6ab2780268 --- /dev/null +++ b/Task/Arrays/CoffeeScript/arrays.coffee @@ -0,0 +1,8 @@ +array1 = [] +array1[0] = "Dillenidae" +array1[1] = "animus" +array1[2] = "Kona" +alert "Elements of array1: " + array1 # Dillenidae,animus,Kona + +array2 = ["Cepphus", "excreta", "Gansu"] +alert "Value of array2[1]: " + array2[1] # excreta diff --git a/Task/Arrays/Eiffel/arrays.e b/Task/Arrays/Eiffel/arrays.e new file mode 100644 index 0000000000..451deb0aab --- /dev/null +++ b/Task/Arrays/Eiffel/arrays.e @@ -0,0 +1,33 @@ +class + APPLICATION + +inherit + ARGUMENTS + +create + make + +feature {NONE} -- Initialization + make + -- Run application. + do + -- initialize the array, index starts at 1 (not zero) and prefill everything with the letter z + create my_static_array.make_filled ("z", 1, 50) + + my_static_array.put ("a", 1) + my_static_array.put ("b", 2) + my_static_array [3] := "c" + + -- access to array fields + print (my_static_array.at(1) + "%N") + print (my_static_array.at(2) + "%N") + print (my_static_array [3] + "%N") + + -- in Eiffel static arrays can be resized in three ways + my_static_array.force ("c", 51) -- forces 'c' in position 51 and resizes the array to that size (now 51 places) + my_static_array.automatic_grow -- adds 50% more indices (having now 76 places) + my_static_array.grow (100) -- resizes the array to 100 places + end + + my_static_array: ARRAY [STRING] +end diff --git a/Task/Arrays/Erlang/arrays.erl b/Task/Arrays/Erlang/arrays.erl new file mode 100644 index 0000000000..6c380035c7 --- /dev/null +++ b/Task/Arrays/Erlang/arrays.erl @@ -0,0 +1,30 @@ + %% Create a fixed-size array with entries 0-9 set to 'undefined' + A0 = array:new(10). + 10 = array:size(A0). + + %% Create an extendible array and set entry 17 to 'true', + %% causing the array to grow automatically + A1 = array:set(17, true, array:new()). + 18 = array:size(A1). + + %% Read back a stored value + true = array:get(17, A1). + + %% Accessing an unset entry returns the default value + undefined = array:get(3, A1). + + %% Accessing an entry beyond the last set entry also returns the + %% default value, if the array does not have fixed size + undefined = array:get(18, A1). + + %% "sparse" functions ignore default-valued entries + A2 = array:set(4, false, A1). + [{4, false}, {17, true}] = array:sparse_to_orddict(A2). + + %% An extendible array can be made fixed-size later + A3 = array:fix(A2). + + %% A fixed-size array does not grow automatically and does not + %% allow accesses beyond the last set entry + {'EXIT',{badarg,_}} = (catch array:set(18, true, A3)). + {'EXIT',{badarg,_}} = (catch array:get(18, A3)). diff --git a/Task/Arrays/Forth/arrays-2.fth b/Task/Arrays/Forth/arrays-2.fth new file mode 100644 index 0000000000..7fd8980b4c --- /dev/null +++ b/Task/Arrays/Forth/arrays-2.fth @@ -0,0 +1,20 @@ +: array ( n -- ) + create + dup , \ remember size at offset 0 + dup cells here swap 0 fill \ fill cells with zero + cells allot \ allocate memory + does> ( i addr -- ) + swap 1+ cells + ; \ hide offset=0 to index [0..n-1] +: [size] -1 ; + +10 array MyArray + +30 7 MyArray ! +7 MyArray @ . \ 30 + +: 5fillMyArray 5 0 do I I MyArray ! loop ; +: .MyArray [size] MyArray @ 0 do I MyArray @ . loop ; + +.MyArray \ 0 0 0 0 0 0 30 0 0 0 +5fillMyArray +.MyArray \ 1 2 3 4 5 0 30 0 0 0 diff --git a/Task/Arrays/Forth/arrays-3.fth b/Task/Arrays/Forth/arrays-3.fth new file mode 100644 index 0000000000..1b69f7e3b7 --- /dev/null +++ b/Task/Arrays/Forth/arrays-3.fth @@ -0,0 +1,15 @@ +: array create dup , dup cells here swap 0 fill cells allot ; +: [size] @ ; +: [cell] 1+ cells + ; \ hide offset=0 to index [0..n-1] + +10 array MyArray + +30 MyArray 7 [cell] ! +MyArray 7 [cell] @ . \ 30 + +: 5fillMyArray 5 0 do I MyArray I [cell] ! loop ; +: .MyArray MyArray [size] 0 do MyArray I [cell] @ . loop ; + +.MyArray \ 0 0 0 0 0 0 30 0 0 0 +5fillMyArray +.MyArray \ 1 2 3 4 5 0 30 0 0 0 diff --git a/Task/Arrays/Forth/arrays.fth b/Task/Arrays/Forth/arrays.fth new file mode 100644 index 0000000000..4c0e27160b --- /dev/null +++ b/Task/Arrays/Forth/arrays.fth @@ -0,0 +1,7 @@ +create MyArray 1 , 2 , 3 , 4 , 5 , 5 cells allot +here constant MyArrayEnd + +30 MyArray 7 cells + ! +MyArray 7 cells + @ . \ 30 + +: .array MyArrayEnd MyArray do I @ . cell +loop ; diff --git a/Task/Arrays/Fortran/arrays-10.f b/Task/Arrays/Fortran/arrays-10.f new file mode 100644 index 0000000000..8362e65e84 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-10.f @@ -0,0 +1 @@ +integer, dimension (10, 10, 10) :: a diff --git a/Task/Arrays/Fortran/arrays-11.f b/Task/Arrays/Fortran/arrays-11.f new file mode 100644 index 0000000000..5c3d004d6f --- /dev/null +++ b/Task/Arrays/Fortran/arrays-11.f @@ -0,0 +1 @@ +integer, dimension (:), allocatable :: a diff --git a/Task/Arrays/Fortran/arrays-12.f b/Task/Arrays/Fortran/arrays-12.f new file mode 100644 index 0000000000..671cd2cdc7 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-12.f @@ -0,0 +1 @@ +integer, dimension (:, :), allocatable :: a diff --git a/Task/Arrays/Fortran/arrays-13.f b/Task/Arrays/Fortran/arrays-13.f new file mode 100644 index 0000000000..d80563bd0c --- /dev/null +++ b/Task/Arrays/Fortran/arrays-13.f @@ -0,0 +1 @@ +allocate (a (10)) diff --git a/Task/Arrays/Fortran/arrays-14.f b/Task/Arrays/Fortran/arrays-14.f new file mode 100644 index 0000000000..61c7b0fe42 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-14.f @@ -0,0 +1 @@ +allocate (a (10, 10)) diff --git a/Task/Arrays/Fortran/arrays-15.f b/Task/Arrays/Fortran/arrays-15.f new file mode 100644 index 0000000000..1109101cff --- /dev/null +++ b/Task/Arrays/Fortran/arrays-15.f @@ -0,0 +1 @@ +deallocate (a) diff --git a/Task/Arrays/Fortran/arrays-16.f b/Task/Arrays/Fortran/arrays-16.f new file mode 100644 index 0000000000..6871a9db80 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-16.f @@ -0,0 +1 @@ +integer, dimension (10) :: a = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/) diff --git a/Task/Arrays/Fortran/arrays-17.f b/Task/Arrays/Fortran/arrays-17.f new file mode 100644 index 0000000000..0bb7665764 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-17.f @@ -0,0 +1,2 @@ +integer :: i +integer, dimension (10) :: a = (/(i * i, i = 1, 10)/) diff --git a/Task/Arrays/Fortran/arrays-18.f b/Task/Arrays/Fortran/arrays-18.f new file mode 100644 index 0000000000..eaa6ff955f --- /dev/null +++ b/Task/Arrays/Fortran/arrays-18.f @@ -0,0 +1 @@ +integer, dimension (10) :: a = 0 diff --git a/Task/Arrays/Fortran/arrays-19.f b/Task/Arrays/Fortran/arrays-19.f new file mode 100644 index 0000000000..ea7d101328 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-19.f @@ -0,0 +1,2 @@ +integer :: i +integer, dimension (10, 10) :: a = reshape ((/(i * i, i = 1, 100)/), (/10, 10/)) diff --git a/Task/Arrays/Fortran/arrays-2.f b/Task/Arrays/Fortran/arrays-2.f new file mode 100644 index 0000000000..8e8ee3bc49 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-2.f @@ -0,0 +1 @@ +integer :: a (10) diff --git a/Task/Arrays/Fortran/arrays-20.f b/Task/Arrays/Fortran/arrays-20.f new file mode 100644 index 0000000000..281246441e --- /dev/null +++ b/Task/Arrays/Fortran/arrays-20.f @@ -0,0 +1,2 @@ +integer :: i +integer, dimension (10), parameter :: a = (/(i * i, i = 1, 10)/) diff --git a/Task/Arrays/Fortran/arrays-21.f b/Task/Arrays/Fortran/arrays-21.f new file mode 100644 index 0000000000..2d44a461cb --- /dev/null +++ b/Task/Arrays/Fortran/arrays-21.f @@ -0,0 +1 @@ +a (1) = 1 diff --git a/Task/Arrays/Fortran/arrays-22.f b/Task/Arrays/Fortran/arrays-22.f new file mode 100644 index 0000000000..522ee025e0 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-22.f @@ -0,0 +1 @@ +a (1, 1) = 1 diff --git a/Task/Arrays/Fortran/arrays-23.f b/Task/Arrays/Fortran/arrays-23.f new file mode 100644 index 0000000000..7ac24596b5 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-23.f @@ -0,0 +1 @@ +a = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/) diff --git a/Task/Arrays/Fortran/arrays-24.f b/Task/Arrays/Fortran/arrays-24.f new file mode 100644 index 0000000000..9d6cb7600f --- /dev/null +++ b/Task/Arrays/Fortran/arrays-24.f @@ -0,0 +1 @@ +a = (/(i * i, i = 1, 10)/) diff --git a/Task/Arrays/Fortran/arrays-25.f b/Task/Arrays/Fortran/arrays-25.f new file mode 100644 index 0000000000..460e776ef4 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-25.f @@ -0,0 +1 @@ +a = reshape ((/(i * i, i = 1, 100)/), (/10, 10/)) diff --git a/Task/Arrays/Fortran/arrays-26.f b/Task/Arrays/Fortran/arrays-26.f new file mode 100644 index 0000000000..ba3522cab0 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-26.f @@ -0,0 +1 @@ +a = 0 diff --git a/Task/Arrays/Fortran/arrays-27.f b/Task/Arrays/Fortran/arrays-27.f new file mode 100644 index 0000000000..caea20478e --- /dev/null +++ b/Task/Arrays/Fortran/arrays-27.f @@ -0,0 +1 @@ +a (:) = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/) diff --git a/Task/Arrays/Fortran/arrays-28.f b/Task/Arrays/Fortran/arrays-28.f new file mode 100644 index 0000000000..23e65acc44 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-28.f @@ -0,0 +1 @@ +a (1 : 5) = (/1, 2, 3, 4, 5/) diff --git a/Task/Arrays/Fortran/arrays-29.f b/Task/Arrays/Fortran/arrays-29.f new file mode 100644 index 0000000000..8bdbb060bc --- /dev/null +++ b/Task/Arrays/Fortran/arrays-29.f @@ -0,0 +1 @@ +a (: 5) = (/1, 2, 3, 4, 5/) diff --git a/Task/Arrays/Fortran/arrays-3.f b/Task/Arrays/Fortran/arrays-3.f new file mode 100644 index 0000000000..81a1df1307 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-3.f @@ -0,0 +1 @@ +integer, dimension (10) :: a diff --git a/Task/Arrays/Fortran/arrays-30.f b/Task/Arrays/Fortran/arrays-30.f new file mode 100644 index 0000000000..b6a807ae89 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-30.f @@ -0,0 +1 @@ +a (6 :) = (/1, 2, 3, 4, 5/) diff --git a/Task/Arrays/Fortran/arrays-31.f b/Task/Arrays/Fortran/arrays-31.f new file mode 100644 index 0000000000..48f7f1dcba --- /dev/null +++ b/Task/Arrays/Fortran/arrays-31.f @@ -0,0 +1 @@ +a (1 : 5) = (/(i * i, i = 1, 10)/) diff --git a/Task/Arrays/Fortran/arrays-32.f b/Task/Arrays/Fortran/arrays-32.f new file mode 100644 index 0000000000..73232a5ac2 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-32.f @@ -0,0 +1 @@ +a (1 : 5)= 0 diff --git a/Task/Arrays/Fortran/arrays-33.f b/Task/Arrays/Fortran/arrays-33.f new file mode 100644 index 0000000000..01b67201b5 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-33.f @@ -0,0 +1 @@ +a (1, :)= (/(i * i, i = 1, 10)/) diff --git a/Task/Arrays/Fortran/arrays-34.f b/Task/Arrays/Fortran/arrays-34.f new file mode 100644 index 0000000000..b315ff2046 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-34.f @@ -0,0 +1 @@ +a (1 : 5, 1)= (/(i * i, i = 1, 5)/) diff --git a/Task/Arrays/Fortran/arrays-35.f b/Task/Arrays/Fortran/arrays-35.f new file mode 100644 index 0000000000..cd32468e78 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-35.f @@ -0,0 +1 @@ +i = a (1) diff --git a/Task/Arrays/Fortran/arrays-36.f b/Task/Arrays/Fortran/arrays-36.f new file mode 100644 index 0000000000..84f65f42b5 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-36.f @@ -0,0 +1 @@ +a = b (1 : 10) diff --git a/Task/Arrays/Fortran/arrays-37.f b/Task/Arrays/Fortran/arrays-37.f new file mode 100644 index 0000000000..4b95054a17 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-37.f @@ -0,0 +1 @@ +i = size (a) diff --git a/Task/Arrays/Fortran/arrays-38.f b/Task/Arrays/Fortran/arrays-38.f new file mode 100644 index 0000000000..fb8fd1befb --- /dev/null +++ b/Task/Arrays/Fortran/arrays-38.f @@ -0,0 +1 @@ +i = size (a, 1) diff --git a/Task/Arrays/Fortran/arrays-39.f b/Task/Arrays/Fortran/arrays-39.f new file mode 100644 index 0000000000..18c48287cd --- /dev/null +++ b/Task/Arrays/Fortran/arrays-39.f @@ -0,0 +1 @@ +i_min = lbound (a) diff --git a/Task/Arrays/Fortran/arrays-4.f b/Task/Arrays/Fortran/arrays-4.f new file mode 100644 index 0000000000..81a1df1307 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-4.f @@ -0,0 +1 @@ +integer, dimension (10) :: a diff --git a/Task/Arrays/Fortran/arrays-40.f b/Task/Arrays/Fortran/arrays-40.f new file mode 100644 index 0000000000..52c346bf32 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-40.f @@ -0,0 +1 @@ +i_max = ubound (a) diff --git a/Task/Arrays/Fortran/arrays-41.f b/Task/Arrays/Fortran/arrays-41.f new file mode 100644 index 0000000000..908ed87d98 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-41.f @@ -0,0 +1 @@ +a = ubound (b) diff --git a/Task/Arrays/Fortran/arrays-5.f b/Task/Arrays/Fortran/arrays-5.f new file mode 100644 index 0000000000..1fc1cf0a12 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-5.f @@ -0,0 +1 @@ +integer, dimension (1 : 10) :: a diff --git a/Task/Arrays/Fortran/arrays-6.f b/Task/Arrays/Fortran/arrays-6.f new file mode 100644 index 0000000000..c9249b48d0 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-6.f @@ -0,0 +1 @@ +integer, dimension (0 : 9) :: a diff --git a/Task/Arrays/Fortran/arrays-7.f b/Task/Arrays/Fortran/arrays-7.f new file mode 100644 index 0000000000..b3a3747510 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-7.f @@ -0,0 +1 @@ +real, dimension (10) :: a diff --git a/Task/Arrays/Fortran/arrays-8.f b/Task/Arrays/Fortran/arrays-8.f new file mode 100644 index 0000000000..54ab507901 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-8.f @@ -0,0 +1 @@ +type (my_type), dimension (10) :: a diff --git a/Task/Arrays/Fortran/arrays-9.f b/Task/Arrays/Fortran/arrays-9.f new file mode 100644 index 0000000000..f2a0aece56 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-9.f @@ -0,0 +1 @@ +integer, dimension (10, 10) :: a diff --git a/Task/Arrays/Fortran/arrays.f b/Task/Arrays/Fortran/arrays.f new file mode 100644 index 0000000000..f53cc5e8a6 --- /dev/null +++ b/Task/Arrays/Fortran/arrays.f @@ -0,0 +1 @@ +integer a (10) diff --git a/Task/Arrays/Go/arrays.go b/Task/Arrays/Go/arrays.go new file mode 100644 index 0000000000..2ea35230e5 --- /dev/null +++ b/Task/Arrays/Go/arrays.go @@ -0,0 +1,63 @@ +package main + +import ( + "fmt" +) + +func main() { + // creates an array of five ints. + // specified length must be a compile-time constant expression. + // this allows compiler to do efficient bounds checking. + var a [5]int + + // since length is compile-time constant, len() is a compile time constant + // and does not have the overhead of a function call. + fmt.Println("len(a) =", len(a)) + + // elements are always initialized to 0 + fmt.Println("a =", a) + + // assign a value to an element. indexing is 0 based. + a[0] = 3 + fmt.Println("a =", a) + + // retrieve element value with same syntax + fmt.Println("a[0] =", a[0]) + + // a slice references an underlying array + s := a[:4] // this does not allocate new array space. + fmt.Println("s =", s) + + // slices have runtime established length and capacity, but len() and + // cap() are built in to the compiler and have overhead more like + // variable access than function call. + fmt.Println("len(s) =", len(s), " cap(s) =", cap(s)) + + // slices can be resliced, as long as there is space + // in the underlying array. + s = s[:5] + fmt.Println("s =", s) + + // s still based on a + a[0] = 22 + fmt.Println("a =", a) + fmt.Println("s =", s) + + // append will automatically allocate a larger underlying array as needed. + s = append(s, 4, 5, 6) + fmt.Println("s =", s) + fmt.Println("len(s) =", len(s), " cap(s) =", cap(s)) + + // s no longer based on a + a[4] = -1 + fmt.Println("a =", a) + fmt.Println("s =", s) + + // make creates a slice and allocates a new underlying array + s = make([]int, 8) + fmt.Println("s =", s) + fmt.Println("len(s) =", len(s), " cap(s) =", cap(s)) + + // the cap()=10 array is no longer referenced + // and would be garbage collected eventually. +} diff --git a/Task/Arrays/Haskell/arrays.hs b/Task/Arrays/Haskell/arrays.hs new file mode 100644 index 0000000000..a403dfd672 --- /dev/null +++ b/Task/Arrays/Haskell/arrays.hs @@ -0,0 +1,7 @@ +import Data.Array.IO + +main = do arr <- newArray (1,10) 37 :: IO (IOArray Int Int) + a <- readArray arr 1 + writeArray arr 1 64 + b <- readArray arr 1 + print (a,b) diff --git a/Task/Arrays/Java/arrays-2.java b/Task/Arrays/Java/arrays-2.java new file mode 100644 index 0000000000..af415acc40 --- /dev/null +++ b/Task/Arrays/Java/arrays-2.java @@ -0,0 +1,4 @@ +ArrayList list = new ArrayList ();//optionally add an initial size as an argument +list.add(5);//appends to the end of the list +list.add(1, 6);//assigns the element at index 1 +System.out.println(list.get(0)); diff --git a/Task/Arrays/Java/arrays.java b/Task/Arrays/Java/arrays.java new file mode 100644 index 0000000000..20f5bcec3b --- /dev/null +++ b/Task/Arrays/Java/arrays.java @@ -0,0 +1,3 @@ +int[] array = new int[10]; //optionally, replace "new int[10]" with a braced list of ints like "{1, 2, 3}" +array[0] = 42; +System.out.println(array[3]); diff --git a/Task/Arrays/JavaScript/arrays.js b/Task/Arrays/JavaScript/arrays.js new file mode 100644 index 0000000000..61eb7749ce --- /dev/null +++ b/Task/Arrays/JavaScript/arrays.js @@ -0,0 +1,19 @@ +// Create a new array with length 0 +var myArray = new Array(); + +// Create a new array with length 5 +var myArray1 = new Array(5); + +// Create an array with 2 members (length is 2) +var myArray2 = new Array("Item1","Item2"); + +// Create an array with 2 members using an array literal +var myArray3 = ["Item1", "Item2"]; + +// Assign a value to member [2] (length is now 3) +myArray[2] = 5; + +var x = myArray[2] + myArray.length; // 8 + +// Elisions are supported, but are buggy in some implementations +var y = [0,1,,]; // length 3, or 4 in buggy implementations diff --git a/Task/Arrays/Lua/arrays.lua b/Task/Arrays/Lua/arrays.lua new file mode 100644 index 0000000000..2bd58cae15 --- /dev/null +++ b/Task/Arrays/Lua/arrays.lua @@ -0,0 +1,7 @@ +l = {} +l[1] = 1 -- Index starts with 1, not 0. +l[0] = 'zero' -- But you can use 0 if you want +l[10] = 2 -- Indexes need not be continuous +l.a = 3 -- Treated as l['a']. Any object can be used as index +l[l] = l -- Again, any object can be used as an index. Even other tables +for i,v in next,l do print (i,v) end diff --git a/Task/Arrays/PHP/arrays-10.php b/Task/Arrays/PHP/arrays-10.php new file mode 100644 index 0000000000..1d2d0181bf --- /dev/null +++ b/Task/Arrays/PHP/arrays-10.php @@ -0,0 +1 @@ +$BlankArray = array(); diff --git a/Task/Arrays/PHP/arrays-11.php b/Task/Arrays/PHP/arrays-11.php new file mode 100644 index 0000000000..ed3cfc61e0 --- /dev/null +++ b/Task/Arrays/PHP/arrays-11.php @@ -0,0 +1 @@ +$BlankArray[] = "Not Blank Anymore"; diff --git a/Task/Arrays/PHP/arrays-12.php b/Task/Arrays/PHP/arrays-12.php new file mode 100644 index 0000000000..2bb5dcc57d --- /dev/null +++ b/Task/Arrays/PHP/arrays-12.php @@ -0,0 +1 @@ +$AssignArray["CertainKey"] = "Value"; diff --git a/Task/Arrays/PHP/arrays-2.php b/Task/Arrays/PHP/arrays-2.php new file mode 100644 index 0000000000..3321443d25 --- /dev/null +++ b/Task/Arrays/PHP/arrays-2.php @@ -0,0 +1,6 @@ +$MultiArray = array( + array(0, 0, 0, 0, 0, 0), + array(1, 1, 1, 1, 1, 1), + array(2, 2, 2, 2, 2, 2), + array(3, 3, 3, 3, 3, 3) + ); diff --git a/Task/Arrays/PHP/arrays-3.php b/Task/Arrays/PHP/arrays-3.php new file mode 100644 index 0000000000..ae03e97e10 --- /dev/null +++ b/Task/Arrays/PHP/arrays-3.php @@ -0,0 +1,2 @@ +echo $NumberArray[5]; // Returns 5 +echo $LetterArray[5]; // Returns f diff --git a/Task/Arrays/PHP/arrays-4.php b/Task/Arrays/PHP/arrays-4.php new file mode 100644 index 0000000000..dbec29fa5b --- /dev/null +++ b/Task/Arrays/PHP/arrays-4.php @@ -0,0 +1 @@ +echo $MultiArray[1][5]; // 2 diff --git a/Task/Arrays/PHP/arrays-5.php b/Task/Arrays/PHP/arrays-5.php new file mode 100644 index 0000000000..86f04db73b --- /dev/null +++ b/Task/Arrays/PHP/arrays-5.php @@ -0,0 +1 @@ +print_r($MultiArray); diff --git a/Task/Arrays/PHP/arrays-6.php b/Task/Arrays/PHP/arrays-6.php new file mode 100644 index 0000000000..701458228c --- /dev/null +++ b/Task/Arrays/PHP/arrays-6.php @@ -0,0 +1,34 @@ +Array( + 0 => array( + 0 => 0 + 1 => 0 + 2 => 0 + 3 => 0 + 4 => 0 + 5 => 0 + ) + 1 => array( + 0 => 1 + 1 => 1 + 2 => 1 + 3 => 1 + 4 => 1 + 5 => 1 + ) + 2 => array( + 0 => 2 + 1 => 2 + 2 => 2 + 3 => 2 + 4 => 2 + 5 => 2 + ) + 3 => array( + 0 => 3 + 1 => 3 + 2 => 3 + 3 => 3 + 4 => 3 + 5 => 3 + ) +) diff --git a/Task/Arrays/PHP/arrays-7.php b/Task/Arrays/PHP/arrays-7.php new file mode 100644 index 0000000000..26108d73e7 --- /dev/null +++ b/Task/Arrays/PHP/arrays-7.php @@ -0,0 +1 @@ +$StartIndexAtOne = array(1 => "A", "B", "C", "D"); diff --git a/Task/Arrays/PHP/arrays-8.php b/Task/Arrays/PHP/arrays-8.php new file mode 100644 index 0000000000..cb1ec1e873 --- /dev/null +++ b/Task/Arrays/PHP/arrays-8.php @@ -0,0 +1 @@ +$CustomKeyArray = array("d" => "A", "c" => "B", "b" =>"C", "a" =>"D"); diff --git a/Task/Arrays/PHP/arrays-9.php b/Task/Arrays/PHP/arrays-9.php new file mode 100644 index 0000000000..434f9c3f9d --- /dev/null +++ b/Task/Arrays/PHP/arrays-9.php @@ -0,0 +1 @@ +echo $CustomKeyArray["b"]; // Returns C diff --git a/Task/Arrays/PHP/arrays.php b/Task/Arrays/PHP/arrays.php new file mode 100644 index 0000000000..321a55f67c --- /dev/null +++ b/Task/Arrays/PHP/arrays.php @@ -0,0 +1,2 @@ +$NumberArray = array(0, 1, 2, 3, 4, 5, 6); +$LetterArray = array("a", "b", "c", "d", "e", "f"); diff --git a/Task/Arrays/Perl/arrays.pl b/Task/Arrays/Perl/arrays.pl new file mode 100644 index 0000000000..1ae2cc90aa --- /dev/null +++ b/Task/Arrays/Perl/arrays.pl @@ -0,0 +1,8 @@ +my @arr; + +push @arr, 1; +push @arr, 3; + +$arr[0] = 2; + +print $arr[0]; diff --git a/Task/Arrays/PicoLisp/arrays-2.l b/Task/Arrays/PicoLisp/arrays-2.l new file mode 100644 index 0000000000..4db82f0306 --- /dev/null +++ b/Task/Arrays/PicoLisp/arrays-2.l @@ -0,0 +1,2 @@ +(set (nth A 2 2) 'B) +(mapc println A) diff --git a/Task/Arrays/PicoLisp/arrays-3.l b/Task/Arrays/PicoLisp/arrays-3.l new file mode 100644 index 0000000000..c7aa946cee --- /dev/null +++ b/Task/Arrays/PicoLisp/arrays-3.l @@ -0,0 +1,2 @@ +(push (cdr A) 1) +(mapc println A) diff --git a/Task/Arrays/PicoLisp/arrays-4.l b/Task/Arrays/PicoLisp/arrays-4.l new file mode 100644 index 0000000000..21c808ef10 --- /dev/null +++ b/Task/Arrays/PicoLisp/arrays-4.l @@ -0,0 +1,2 @@ +(queue (cdr A) 9) +(mapc println A) diff --git a/Task/Arrays/PicoLisp/arrays.l b/Task/Arrays/PicoLisp/arrays.l new file mode 100644 index 0000000000..92ac9e3b9d --- /dev/null +++ b/Task/Arrays/PicoLisp/arrays.l @@ -0,0 +1,2 @@ +(setq A '((1 2 3) (a b c) ((d e) NIL 777))) # Create a 3x3 structure +(mapc println A) # Show it diff --git a/Task/Arrays/Prolog/arrays-2.pro b/Task/Arrays/Prolog/arrays-2.pro new file mode 100644 index 0000000000..635c294013 --- /dev/null +++ b/Task/Arrays/Prolog/arrays-2.pro @@ -0,0 +1,8 @@ +destructive:- + functor(Array,array,100), % create a term with 100 free Variables as arguments + % index of arguments start at 1 + setarg(1 ,Array,a), % put an a at position 1 + setarg(12,Array,b), % put an b at position 12 + setarg(1, Array,c), % overwrite value at position 1 with c + arg(1 ,Array,Value1), % get the value at position 1 + print(Value1),nl. % will print Value1 and therefore c followed by a newline diff --git a/Task/Arrays/Prolog/arrays-3.pro b/Task/Arrays/Prolog/arrays-3.pro new file mode 100644 index 0000000000..d828282fd5 --- /dev/null +++ b/Task/Arrays/Prolog/arrays-3.pro @@ -0,0 +1,9 @@ +listvariant:- + length(List,100), % create a list of length 100 + nth1(1 ,List,a), % put an a at position 1 , nth1/3 uses indexing from 1, nth0/3 from 0 + nth1(12,List,b), % put an b at position 3 + append(List,[d],List2), % append an d at the end , List2 has 101 elements + length(Add,10), % create a new list of length 10 + append(List2,Add,List3), % append 10 free variables to List2 , List3 now has 111 elements + nth1(1 ,List3,Value), % get the value at position 1 + print(Value),nl. % will print out a diff --git a/Task/Arrays/Prolog/arrays.pro b/Task/Arrays/Prolog/arrays.pro new file mode 100644 index 0000000000..efd56e98f2 --- /dev/null +++ b/Task/Arrays/Prolog/arrays.pro @@ -0,0 +1,9 @@ +singleassignment:- + functor(Array,array,100), % create a term with 100 free Variables as arguments + % index of arguments start at 1 + arg(1 ,Array,a), % put an a at position 1 + arg(12,Array,b), % put an b at position 12 + arg(1 ,Array,Value1), % get the value at position 1 + print(Value1),nl, % will print Value1 and therefore a followed by a newline + arg(4 ,Array,Value2), % get the value at position 4 which is a free Variable + print(Value2),nl. % will print that it is a free Variable followed by a newline diff --git a/Task/Arrays/Python/arrays-2.py b/Task/Arrays/Python/arrays-2.py new file mode 100644 index 0000000000..4359301b44 --- /dev/null +++ b/Task/Arrays/Python/arrays-2.py @@ -0,0 +1 @@ +myArray = [0] * size diff --git a/Task/Arrays/Python/arrays-3.py b/Task/Arrays/Python/arrays-3.py new file mode 100644 index 0000000000..493c85b37c --- /dev/null +++ b/Task/Arrays/Python/arrays-3.py @@ -0,0 +1 @@ +myArray = [[0]* width] * height] # DOES NOT WORK AS INTENDED!!! diff --git a/Task/Arrays/Python/arrays-4.py b/Task/Arrays/Python/arrays-4.py new file mode 100644 index 0000000000..3d20ddd902 --- /dev/null +++ b/Task/Arrays/Python/arrays-4.py @@ -0,0 +1 @@ +myArray = [[0 for x in range(width)] for y in range(height)] diff --git a/Task/Arrays/Python/arrays-5.py b/Task/Arrays/Python/arrays-5.py new file mode 100644 index 0000000000..c36af1ea73 --- /dev/null +++ b/Task/Arrays/Python/arrays-5.py @@ -0,0 +1,3 @@ +myArray = list() +for x in range(height): + myArray.append([0] * width) diff --git a/Task/Arrays/Python/arrays-6.py b/Task/Arrays/Python/arrays-6.py new file mode 100644 index 0000000000..3c89fa85cc --- /dev/null +++ b/Task/Arrays/Python/arrays-6.py @@ -0,0 +1,9 @@ +# Retrieve an element directly from the array. +item = array[index] + +# Use the array like a stack. Note that using the pop() method removes the element. +array.pop() # Pop last item in a list +array.pop(0) # Pop first item in a list + +# Using a negative element counts from the end of the list. +item = array[-1] # Retrieve last element in a list. diff --git a/Task/Arrays/Python/arrays-7.py b/Task/Arrays/Python/arrays-7.py new file mode 100644 index 0000000000..dad80a46ce --- /dev/null +++ b/Task/Arrays/Python/arrays-7.py @@ -0,0 +1,6 @@ +try: + # This will cause an exception, which will then be caught. + print array[len(array)] +except IndexError as e: + # Print the exception. + print e diff --git a/Task/Arrays/Python/arrays.py b/Task/Arrays/Python/arrays.py new file mode 100644 index 0000000000..a64e25fbb8 --- /dev/null +++ b/Task/Arrays/Python/arrays.py @@ -0,0 +1,8 @@ +array = [] + +array.append(1) +array.append(3) + +array[0] = 2 + +print array[0] diff --git a/Task/Arrays/R/arrays.r b/Task/Arrays/R/arrays.r new file mode 100644 index 0000000000..f45bdea0c9 --- /dev/null +++ b/Task/Arrays/R/arrays.r @@ -0,0 +1,7 @@ +arr <- array(1) + +arr <- append(arr,3) + +arr[1] <- 2 + +print(arr[1]) diff --git a/Task/Arrays/REXX/arrays-2.rexx b/Task/Arrays/REXX/arrays-2.rexx new file mode 100644 index 0000000000..00d8156abb --- /dev/null +++ b/Task/Arrays/REXX/arrays-2.rexx @@ -0,0 +1,13 @@ +/*REXX program demonstrates array usage with mimicry. */ +a. = 'not found' /*value for all a.xxx (so far). */ + + do j=1 to 100 /*start at 1, define 100 elements*/ + a.j = -j * 100 /*define element as -J thousand.*/ + end /*j*/ /*the above defines 100 elements.*/ + +say 'element 50 is:' a(50) +say 'element 3000 is:' a(3000) +exit /*stick a fork in it, we're done.*/ + +/*──────────────────────────────────A subroutine────────────────────────*/ +a: _a_ = arg(1); return a._a_ diff --git a/Task/Arrays/REXX/arrays-3.rexx b/Task/Arrays/REXX/arrays-3.rexx new file mode 100644 index 0000000000..2383e066f4 --- /dev/null +++ b/Task/Arrays/REXX/arrays-3.rexx @@ -0,0 +1,9 @@ +/*REXX program demonstrates array usage with assigned default.*/ +a.=00 /*value for all a.xxx (so far). */ + + do j=1 to 100 /*start at 1, define 100 array elements.*/ + a.j=-j*100 /*define element as negative J thousand.*/ + end /*the above defines 100 elements. */ + +say 'element 50 is:' a.50 +say 'element 3000 is:' a.3000 diff --git a/Task/Arrays/REXX/arrays-4.rexx b/Task/Arrays/REXX/arrays-4.rexx new file mode 100644 index 0000000000..790ae197dd --- /dev/null +++ b/Task/Arrays/REXX/arrays-4.rexx @@ -0,0 +1,10 @@ +/*REXX program demonstrates array usage. */ +array.='out of range' /*for now, define ALL elements to this. */ + + do j=-3000 to 3000 /*start at -3k, going up to +3k. */ + array.j=j**2 /*define element as it's square. */ + end /*the above defines 6,001 elements. */ + +g=-7 +say g "squared is:" array.g +say 7000 "squared is:" array.7000 diff --git a/Task/Arrays/REXX/arrays-5.rexx b/Task/Arrays/REXX/arrays-5.rexx new file mode 100644 index 0000000000..b83e4c6e75 --- /dev/null +++ b/Task/Arrays/REXX/arrays-5.rexx @@ -0,0 +1,16 @@ +/*REXX program demonstrates disjointed array usage. */ +yr.='year not supported' /*value for all yr.xxx (so far). */ + + do k=600 to 1100 /*Define a bunch of years prior to 1800.*/ + yr.k=k "AD" + end + + do j=1800 to 2100 /*start at 1800, define a bunch of years*/ + yr.j=j 'AD' /*define Jth element as the year itself.*/ + end /*the above defines 301 elements. */ + +year=1946 +say 'DOB' year "is:" yr.year + +year=1744 +say 'DOB' year "is:" yr.year diff --git a/Task/Arrays/REXX/arrays-6.rexx b/Task/Arrays/REXX/arrays-6.rexx new file mode 100644 index 0000000000..e696d8885d --- /dev/null +++ b/Task/Arrays/REXX/arrays-6.rexx @@ -0,0 +1,29 @@ +/*REXX program demonstrates array usage: sparse and disjointed. */ +yyy = -55 +a.yyy = 1e9 /*REXX must use this mechanism for neg idx.*/ + +a.1=1000 +a.2=2000.0001 +a.7 = 7000 +a.2012 = 'out here in left field.' +a.cat='civet, but not a true cat --- belonging to the family Viverridae' +a.civet="A.K.A.: toddycats" + +/*------------------------------------------------------------------------ + Array elements need not be continous (nor even defined). They can hold + any nanner of numbers, or strings (which can include any characters, + including null or '00'x characters). + + Array elements need not be numeric, as the above code demonstrates. + Indeed, the element "name" can be ANYTHING, even non-displayable + characters. To illustrate: +--------------------------------------------------------------------------*/ + +stuff=')g.u.t.s( or ½ of an intestine!' +a.stuff=44 + +/*-------------------------------------------------------------- + where the element name has special characters, blanks, and + the glyph of one-half, as well as the symbol used in REXX to + indentify stemmed arrays (the period). +----------------------------------------------------------------*/ diff --git a/Task/Arrays/REXX/arrays.rexx b/Task/Arrays/REXX/arrays.rexx new file mode 100644 index 0000000000..b44345aaad --- /dev/null +++ b/Task/Arrays/REXX/arrays.rexx @@ -0,0 +1,9 @@ +/*REXX program demonstrates array usage. */ +a.='not found' /*value for all a.xxx (so far). */ + + do j=1 to 100 /*start at 1, define 100 array elements.*/ + a.j=-j*100 /*define element as negative J thousand.*/ + end /*the above defines 100 elements. */ + +say 'element 50 is:' a.50 +say 'element 3000 is:' a.3000 diff --git a/Task/Arrays/Racket/arrays.rkt b/Task/Arrays/Racket/arrays.rkt new file mode 100644 index 0000000000..02cf3bf5db --- /dev/null +++ b/Task/Arrays/Racket/arrays.rkt @@ -0,0 +1,12 @@ +#lang racket + +;; import dynamic arrays +(require data/gvector) + +(define v (vector 1 2 3 4)) ; array +(vector-ref v 0) ; 1 +(vector-set! v 1 4) ; 2 -> 4 + +(define gv (gvector 1 2 3 4)) ; dynamic array +(gvector-ref gv 0) ; 1 +(gvector-add! gv 5) ; increase size diff --git a/Task/Arrays/Ruby/arrays.rb b/Task/Arrays/Ruby/arrays.rb new file mode 100644 index 0000000000..53786d4c0a --- /dev/null +++ b/Task/Arrays/Ruby/arrays.rb @@ -0,0 +1,20 @@ +# create an array with one object in it +a = ['foo'] + +# the Array#new method allows several additional ways to create arrays + +# push objects into the array +a << 1 # ["foo", 1] +a.push(3,4,5) # ["foo", 1, 3, 4, 5] + +# set the value at a specific index in the array +a[0] = 2 # [2, 1, 3, 4, 5] + +# a couple of ways to set a slice of the array +a[0,3] = 'bar' # ["bar", 4, 5] +a[1..-1] = 'baz' # ["bar", "baz"] +a[0] = nil # [nil, "baz"] +a[0,1] = nil # ["baz"] + +# retrieve an element +puts a[0] diff --git a/Task/Arrays/Sather/arrays.sa b/Task/Arrays/Sather/arrays.sa new file mode 100644 index 0000000000..f03eba2984 --- /dev/null +++ b/Task/Arrays/Sather/arrays.sa @@ -0,0 +1,12 @@ +-- a is an array of INTs +a :ARRAY{INT}; +-- create an array of five "void" elements +a := #ARRAY{INT}(5); +-- static creation of an array with three elements +b :ARRAY{FLT} := |1.2, 1.3, 1.4|; +-- accessing an array element +c ::= b[0]; -- syntactic sugar for b.aget(0) +-- set an array element +b[1] := c; -- syntactic sugar for b.aset(1, c) +-- append another array +b := b.append(|5.5|); diff --git a/Task/Arrays/Scala/arrays-2.scala b/Task/Arrays/Scala/arrays-2.scala new file mode 100644 index 0000000000..bf0a3d070f --- /dev/null +++ b/Task/Arrays/Scala/arrays-2.scala @@ -0,0 +1,3 @@ +val a = new collection.mutable.ArrayBuffer[Int] +a += 5 // Append value 5 to the end of the list +a(0) = 6 // Assign value 6 to element 0 diff --git a/Task/Arrays/Scala/arrays.scala b/Task/Arrays/Scala/arrays.scala new file mode 100644 index 0000000000..8d7072e1eb --- /dev/null +++ b/Task/Arrays/Scala/arrays.scala @@ -0,0 +1,11 @@ +// Create a new integer array with capacity 10 +val a = new Array[Int](10) + +// Create a new array containing specified items +val b = Array("foo", "bar", "baz") + +// Assign a value to element zero +a(0) = 42 + +// Retrieve item at element 2 +val c = b(2) diff --git a/Task/Arrays/Scheme/arrays.ss b/Task/Arrays/Scheme/arrays.ss new file mode 100644 index 0000000000..24528d503b --- /dev/null +++ b/Task/Arrays/Scheme/arrays.ss @@ -0,0 +1,5 @@ +(let ((array #(1 2 3 4 5)) ; vector literal + (array2 (make-vector 5)) ; default is unspecified + (array3 (make-vector 5 0))) ; default 0 + (vector-set! array 0 3) + (vector-ref array 0)) ; 3 diff --git a/Task/Arrays/Smalltalk/arrays-2.st b/Task/Arrays/Smalltalk/arrays-2.st new file mode 100644 index 0000000000..19cdc94bac --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-2.st @@ -0,0 +1,12 @@ +|array| +"creates an array that holds up to 20 elements" +array := Array new: 20 . +"access the first element: array base is 1" +(array at: 1) displayNl. +"put 100 as second value; you can put any object, + in particular SmallInteger" +array at: 2 put: 100. +"initialize an array from a 'constant' given array" +array := Array withAll: #('an' 'apple' 'a' 'day' 'keeps' 'the' 'doctor' 'away'). +"Replacing apple with orange" +array at: 2 put: 'orange'. diff --git a/Task/Arrays/Smalltalk/arrays-3.st b/Task/Arrays/Smalltalk/arrays-3.st new file mode 100644 index 0000000000..1a4d315f62 --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-3.st @@ -0,0 +1,7 @@ +"assigning values to an array" +"suppose array is bound to an array of 20 values" +array at: 5 put: 'substitute fifth element'. + +[ array at: 21 put: 'error' ] + on: SystemExceptions.IndexOutOfRange + do: [ :sig | 'Out of range!' displayNl ]. diff --git a/Task/Arrays/Smalltalk/arrays-4.st b/Task/Arrays/Smalltalk/arrays-4.st new file mode 100644 index 0000000000..55570dc9b6 --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-4.st @@ -0,0 +1,2 @@ +"retrieving a value from an array" + #($a $b $c) at: 2 diff --git a/Task/Arrays/Smalltalk/arrays-5.st b/Task/Arrays/Smalltalk/arrays-5.st new file mode 100644 index 0000000000..71794a6663 --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-5.st @@ -0,0 +1,3 @@ +array do:[:each | each printOn: aStream ] +array collect:[:each | each squared| +array select:[:each | each > 10] diff --git a/Task/Arrays/Smalltalk/arrays-6.st b/Task/Arrays/Smalltalk/arrays-6.st new file mode 100644 index 0000000000..f024d97a36 --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-6.st @@ -0,0 +1 @@ +{ Time now . 10 . Date today . 'foo' } diff --git a/Task/Arrays/Smalltalk/arrays-7.st b/Task/Arrays/Smalltalk/arrays-7.st new file mode 100644 index 0000000000..8b57b15877 --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-7.st @@ -0,0 +1,12 @@ +oc := OrderedCollection withAll: #(4 5 6). +oc add:1. oc add:2. oc add:3. +foo := oc removeFirst. +oc addFirst:10. +oc removeLast. +oc at:2 put: 'someString'. +oc add:123 beforeIndex:10. +oc asArray printCR. +oc2 := oc copyFrom:5 to:10 +oc indexOf: 'someString' +oc findFirst:[:el | el isString] +"hundreds of other methods skipped here.." diff --git a/Task/Arrays/Smalltalk/arrays.st b/Task/Arrays/Smalltalk/arrays.st new file mode 100644 index 0000000000..b7ee9a071d --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays.st @@ -0,0 +1 @@ +#(1 2 3 'four' 5.0 true false nil (10 20) $a) diff --git a/Task/Arrays/Tcl/arrays-2.tcl b/Task/Arrays/Tcl/arrays-2.tcl new file mode 100644 index 0000000000..89bc0d8cab --- /dev/null +++ b/Task/Arrays/Tcl/arrays-2.tcl @@ -0,0 +1 @@ +puts $ary; # Print the whole array diff --git a/Task/Arrays/Tcl/arrays.tcl b/Task/Arrays/Tcl/arrays.tcl new file mode 100644 index 0000000000..9d450d0cad --- /dev/null +++ b/Task/Arrays/Tcl/arrays.tcl @@ -0,0 +1,8 @@ +set ary {} + +lappend ary 1 +lappend ary 3 + +lset ary 0 2 + +puts [lindex $ary 0] diff --git a/Task/Assertions/0DESCRIPTION b/Task/Assertions/0DESCRIPTION new file mode 100644 index 0000000000..b9fd6eb6b1 --- /dev/null +++ b/Task/Assertions/0DESCRIPTION @@ -0,0 +1,3 @@ +Assertions are a way of breaking out of code when there is an error or an unexpected input. Some languages throw [[exceptions]] and some treat it as a break point. + +Show an assertion in your language by asserting that an integer variable is equal to 42. diff --git a/Task/Assertions/1META.yaml b/Task/Assertions/1META.yaml new file mode 100644 index 0000000000..659c8686af --- /dev/null +++ b/Task/Assertions/1META.yaml @@ -0,0 +1,2 @@ +--- +note: Basic language learning diff --git a/Task/Assertions/C/assertions-2.c b/Task/Assertions/C/assertions-2.c new file mode 100644 index 0000000000..4ad9c894c9 --- /dev/null +++ b/Task/Assertions/C/assertions-2.c @@ -0,0 +1 @@ +assert(a == 42 && "Error message"); diff --git a/Task/Assertions/C/assertions.c b/Task/Assertions/C/assertions.c new file mode 100644 index 0000000000..b071e7f63f --- /dev/null +++ b/Task/Assertions/C/assertions.c @@ -0,0 +1,9 @@ +#include + +int main(){ + int a; + /* ...input or change a here */ + assert(a == 42); /* aborts program when a is not 42, unless the NDEBUG macro was defined */ + + return 0; +} diff --git a/Task/Assertions/Clojure/assertions.clj b/Task/Assertions/Clojure/assertions.clj new file mode 100644 index 0000000000..9a0572d5db --- /dev/null +++ b/Task/Assertions/Clojure/assertions.clj @@ -0,0 +1,2 @@ +(let [i 42] + (assert (= i 42))) diff --git a/Task/Assertions/Eiffel/assertions-2.e b/Task/Assertions/Eiffel/assertions-2.e new file mode 100644 index 0000000000..0b7123f688 --- /dev/null +++ b/Task/Assertions/Eiffel/assertions-2.e @@ -0,0 +1,8 @@ +class TEST + feature assert(val: INTEGER) is + require + val = 42; + do + print("Thanks for the 42!%N"); + end +end diff --git a/Task/Assertions/Eiffel/assertions.e b/Task/Assertions/Eiffel/assertions.e new file mode 100644 index 0000000000..7d150d84c3 --- /dev/null +++ b/Task/Assertions/Eiffel/assertions.e @@ -0,0 +1,12 @@ +class MAIN + creation main + feature main is + local + test: TEST; + do + create test; + + io.read_integer; + test.assert(io.last_integer); + end +end diff --git a/Task/Assertions/Erlang/assertions.erl b/Task/Assertions/Erlang/assertions.erl new file mode 100644 index 0000000000..cd575c3d30 --- /dev/null +++ b/Task/Assertions/Erlang/assertions.erl @@ -0,0 +1,10 @@ +1> N = 42. +42 +2> N = 43. +** exception error: no match of right hand side value 43 +3> N = 42. +42 +4> 44 = N. +** exception error: no match of right hand side value 42 +5> 42 = N. +42 diff --git a/Task/Assertions/Go/assertions.go b/Task/Assertions/Go/assertions.go new file mode 100644 index 0000000000..318a8322c2 --- /dev/null +++ b/Task/Assertions/Go/assertions.go @@ -0,0 +1,8 @@ +package main + +func main() { + x := 43 + if x != 42 { + panic(42) + } +} diff --git a/Task/Assertions/Haskell/assertions.hs b/Task/Assertions/Haskell/assertions.hs new file mode 100644 index 0000000000..9f39817edf --- /dev/null +++ b/Task/Assertions/Haskell/assertions.hs @@ -0,0 +1,5 @@ +import Control.Exception + +main = let a = someValue in + assert (a == 42) -- throws AssertionFailed when a is not 42 + somethingElse -- what to return when a is 42 diff --git a/Task/Assertions/Java/assertions.java b/Task/Assertions/Java/assertions.java new file mode 100644 index 0000000000..5c3fbfa951 --- /dev/null +++ b/Task/Assertions/Java/assertions.java @@ -0,0 +1,8 @@ +public static void main(String[] args){ + int a; + //...input or change a here + assert a == 42;//throws an AssertionError when a is not 42 + assert a == 42 : "Error message"; //throws an AssertionError + //when a is not 42 with "Error message" for the message + //the error message can be any non-void expression +} diff --git a/Task/Assertions/Lua/assertions.lua b/Task/Assertions/Lua/assertions.lua new file mode 100644 index 0000000000..04a005fff9 --- /dev/null +++ b/Task/Assertions/Lua/assertions.lua @@ -0,0 +1,3 @@ +a = 5 +assert (a == 42) +assert (a == 42,'\''..a..'\' is not the answer to life, the universe, and everything') diff --git a/Task/Assertions/PHP/assertions.php b/Task/Assertions/PHP/assertions.php new file mode 100644 index 0000000000..c1fbb865ed --- /dev/null +++ b/Task/Assertions/PHP/assertions.php @@ -0,0 +1,6 @@ + diff --git a/Task/Assertions/Perl/assertions-2.pl b/Task/Assertions/Perl/assertions-2.pl new file mode 100644 index 0000000000..9e24ef6f41 --- /dev/null +++ b/Task/Assertions/Perl/assertions-2.pl @@ -0,0 +1,2 @@ +use autodie; +open my $fh, '<', 'file'; # automatically throws an exception on failure diff --git a/Task/Assertions/Perl/assertions-3.pl b/Task/Assertions/Perl/assertions-3.pl new file mode 100644 index 0000000000..f509bedf3b --- /dev/null +++ b/Task/Assertions/Perl/assertions-3.pl @@ -0,0 +1,9 @@ +my $a = 5; +#...input or change $a here +$a == 42 or die "Error message\n"; +# or, alternatively: +die "Error message\n" unless $a == 42; +# or: +die "Error message\n" if not $a == 42; +# or just: +die "Error message\n" if $a != 42; diff --git a/Task/Assertions/Perl/assertions-4.pl b/Task/Assertions/Perl/assertions-4.pl new file mode 100644 index 0000000000..33c2e2bc07 --- /dev/null +++ b/Task/Assertions/Perl/assertions-4.pl @@ -0,0 +1,2 @@ +use Carp::Assert; +assert($a == 42); diff --git a/Task/Assertions/Perl/assertions-5.pl b/Task/Assertions/Perl/assertions-5.pl new file mode 100644 index 0000000000..024ff7eb26 --- /dev/null +++ b/Task/Assertions/Perl/assertions-5.pl @@ -0,0 +1,4 @@ +is $a, 42; +ok $a == 42; +cmp_ok $a, '==', 42, 'The answer should be 42'; +# etc. diff --git a/Task/Assertions/Perl/assertions.pl b/Task/Assertions/Perl/assertions.pl new file mode 100644 index 0000000000..e47bd1bf69 --- /dev/null +++ b/Task/Assertions/Perl/assertions.pl @@ -0,0 +1 @@ +open my $fh, '<', 'file' or die "Cannot open file: $!\n"; # $! contains the error message from the last error diff --git a/Task/Assertions/PicoLisp/assertions-2.l b/Task/Assertions/PicoLisp/assertions-2.l new file mode 100644 index 0000000000..e8c3ecc53d --- /dev/null +++ b/Task/Assertions/PicoLisp/assertions-2.l @@ -0,0 +1,4 @@ +(let N 41 + (unless (= N 42) (quit "Incorrect N" N)) ) # 'quit' throws an error +41 -- Incorrect N +? diff --git a/Task/Assertions/PicoLisp/assertions-3.l b/Task/Assertions/PicoLisp/assertions-3.l new file mode 100644 index 0000000000..1a4b0dfdfc --- /dev/null +++ b/Task/Assertions/PicoLisp/assertions-3.l @@ -0,0 +1,5 @@ +(let N 41 + (unless (= N 42) (! setq N 42)) ) # '!' is a breakpoint +(setq N 42) # Manually fix the value +! # Hit ENTER to leave the breakpoint +-> 42 diff --git a/Task/Assertions/PicoLisp/assertions.l b/Task/Assertions/PicoLisp/assertions.l new file mode 100644 index 0000000000..76e2fe13ae --- /dev/null +++ b/Task/Assertions/PicoLisp/assertions.l @@ -0,0 +1,3 @@ +... +~(assert (= N 42)) # Exists only in debug mode +... diff --git a/Task/Assertions/Prolog/assertions.pro b/Task/Assertions/Prolog/assertions.pro new file mode 100644 index 0000000000..d779a54d56 --- /dev/null +++ b/Task/Assertions/Prolog/assertions.pro @@ -0,0 +1,2 @@ +test(A):- + assertion(A==42). diff --git a/Task/Assertions/Python/assertions.py b/Task/Assertions/Python/assertions.py new file mode 100644 index 0000000000..f11c153b06 --- /dev/null +++ b/Task/Assertions/Python/assertions.py @@ -0,0 +1,6 @@ +a = 5 +#...input or change a here +assert a == 42 # throws an AssertionError when a is not 42 +assert a == 42, "Error message" # throws an AssertionError + # when a is not 42 with "Error message" for the message + # the error message can be any expression diff --git a/Task/Assertions/R/assertions.r b/Task/Assertions/R/assertions.r new file mode 100644 index 0000000000..24c9a845a1 --- /dev/null +++ b/Task/Assertions/R/assertions.r @@ -0,0 +1 @@ +stopifnot(a==42) diff --git a/Task/Assertions/REXX/assertions.rexx b/Task/Assertions/REXX/assertions.rexx new file mode 100644 index 0000000000..6c06d2f47d --- /dev/null +++ b/Task/Assertions/REXX/assertions.rexx @@ -0,0 +1,24 @@ +/* REXX *************************************************************** +* There's no assert feature in Rexx. That's how I'd implement it +* 10.08.2012 Walter Pachl +**********************************************************************/ +x.=42 +x.2=11 +Do i=1 By 1 + Call assert x.i,42 + End +Exit +assert: + Parse Arg assert_have,assert_should_have + If assert_have\==assert_should_have Then Do + Say 'Assertion fails in line' sigl + Say 'expected:' assert_should_have + Say ' found:' assert_have + Say sourceline(sigl) + Say 'Look around' + Trace ?R + Nop + Signal Syntax + End + Return +Syntax: Say 'program terminated' diff --git a/Task/Assertions/Racket/assertions-2.rkt b/Task/Assertions/Racket/assertions-2.rkt new file mode 100644 index 0000000000..6e34df79fd --- /dev/null +++ b/Task/Assertions/Racket/assertions-2.rkt @@ -0,0 +1,5 @@ +#lang racket + +(define x 80) +(unless (= x 42) + (error "a is not 42")) ; will error diff --git a/Task/Assertions/Racket/assertions.rkt b/Task/Assertions/Racket/assertions.rkt new file mode 100644 index 0000000000..9ee65ef3e1 --- /dev/null +++ b/Task/Assertions/Racket/assertions.rkt @@ -0,0 +1,13 @@ +#lang racket + +(define/contract x + (=/c 42) ; make sure x = 42 + 42) + +(define/contract f + (-> number? (or/c 'yes 'no)) ; function contract + (lambda (x) + (if (= 42 x) 'yes 'no))) + +(f 42) ; succeeds +(f "foo") ; contract error! diff --git a/Task/Assertions/Ruby/assertions.rb b/Task/Assertions/Ruby/assertions.rb new file mode 100644 index 0000000000..77c4f0442b --- /dev/null +++ b/Task/Assertions/Ruby/assertions.rb @@ -0,0 +1,11 @@ +require "test/unit/assertions" +include Test::Unit::Assertions + +n = 5 +begin + assert_equal(42, n) +rescue Exception => e + # Ruby 1.8: e is a Test::Unit::AssertionFailedError + # Ruby 1.9: e is a MiniTest::Assertion + puts e +end diff --git a/Task/Assertions/Sather/assertions.sa b/Task/Assertions/Sather/assertions.sa new file mode 100644 index 0000000000..0672a8145d --- /dev/null +++ b/Task/Assertions/Sather/assertions.sa @@ -0,0 +1,7 @@ +class MAIN is + main is + i ::= 41; + assert i = 42; -- fatal + -- ... + end; +end; diff --git a/Task/Assertions/Scala/assertions-2.scala b/Task/Assertions/Scala/assertions-2.scala new file mode 100644 index 0000000000..0b8fcfc824 --- /dev/null +++ b/Task/Assertions/Scala/assertions-2.scala @@ -0,0 +1,2 @@ +require(a == 42) +require(a == 42, "a isn't equal to 42") diff --git a/Task/Assertions/Scala/assertions-3.scala b/Task/Assertions/Scala/assertions-3.scala new file mode 100644 index 0000000000..5d8647e60f --- /dev/null +++ b/Task/Assertions/Scala/assertions-3.scala @@ -0,0 +1,4 @@ +println(a.ensuring(a == 42)) +println(a.ensuring(a == 42, "a isn't equal to 42")) +println(a.ensuring(_ == 42)) +println(a.ensuring(_ == 42, "a isn't equal to 42")) diff --git a/Task/Assertions/Scala/assertions.scala b/Task/Assertions/Scala/assertions.scala new file mode 100644 index 0000000000..2689d74083 --- /dev/null +++ b/Task/Assertions/Scala/assertions.scala @@ -0,0 +1,4 @@ +assert(a == 42) +assert(a == 42, "a isn't equal to 42") +assume(a == 42) +assume(a == 42, "a isn't equal to 42") diff --git a/Task/Assertions/Scheme/assertions.ss b/Task/Assertions/Scheme/assertions.ss new file mode 100644 index 0000000000..582eb7635e --- /dev/null +++ b/Task/Assertions/Scheme/assertions.ss @@ -0,0 +1,2 @@ +(let ((x 42)) + (assert (and (integer? x) (= x 42)))) diff --git a/Task/Assertions/Smalltalk/assertions-2.st b/Task/Assertions/Smalltalk/assertions-2.st new file mode 100644 index 0000000000..8026f374a4 --- /dev/null +++ b/Task/Assertions/Smalltalk/assertions-2.st @@ -0,0 +1,2 @@ +self assert: (... somethingMustEvaluateToTrue.. ) +self should:[ some code ] raise: someException "ensures that an exception is raised diff --git a/Task/Assertions/Smalltalk/assertions-3.st b/Task/Assertions/Smalltalk/assertions-3.st new file mode 100644 index 0000000000..b626b6a6f8 --- /dev/null +++ b/Task/Assertions/Smalltalk/assertions-3.st @@ -0,0 +1 @@ +self assert: (... somethingMustEvaluateToTrue.. ) "implemented in Object" diff --git a/Task/Assertions/Smalltalk/assertions.st b/Task/Assertions/Smalltalk/assertions.st new file mode 100644 index 0000000000..34e1910aa1 --- /dev/null +++ b/Task/Assertions/Smalltalk/assertions.st @@ -0,0 +1,3 @@ +foo := 41. +... +self assert: (foo == 42). diff --git a/Task/Assertions/Tcl/assertions.tcl b/Task/Assertions/Tcl/assertions.tcl new file mode 100644 index 0000000000..83284d0235 --- /dev/null +++ b/Task/Assertions/Tcl/assertions.tcl @@ -0,0 +1,4 @@ +package require control + +set x 5 +control::assert {$x == 42} diff --git a/Task/Balanced_brackets/0DESCRIPTION b/Task/Balanced_brackets/0DESCRIPTION new file mode 100644 index 0000000000..52b146d0f5 --- /dev/null +++ b/Task/Balanced_brackets/0DESCRIPTION @@ -0,0 +1,10 @@ +'''Task''': +* Generate a string with \mathrm{N} opening brackets (“[”) and \mathrm{N} closing brackets (“]”), in some arbitrary order. +* Determine whether the generated string is ''balanced''; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest. + +'''Examples''': + + (empty) OK + [] OK ][ NOT OK + [][] OK ][][ NOT OK + [[][]] OK []][[] NOT OK diff --git a/Task/Balanced_brackets/AWK/balanced_brackets.awk b/Task/Balanced_brackets/AWK/balanced_brackets.awk new file mode 100644 index 0000000000..e6b151f39e --- /dev/null +++ b/Task/Balanced_brackets/AWK/balanced_brackets.awk @@ -0,0 +1,21 @@ +#!/usr/bin/awk -f +BEGIN { + print isbb("[]") + print isbb("][") + print isbb("][][") + print isbb("[][]") + print isbb("[][][]") + print isbb("[]][[]") +} + +function isbb(x) { + s = 0; + for (k=1; k<=length(x); k++) { + c = substr(x,k,1); + if (c=="[") {s++;} + else { if (c=="]") s--; } + + if (s<0) {return 0}; + } + return (s==0); +} diff --git a/Task/Balanced_brackets/BASIC/balanced_brackets.bas b/Task/Balanced_brackets/BASIC/balanced_brackets.bas new file mode 100644 index 0000000000..ffc201be3e --- /dev/null +++ b/Task/Balanced_brackets/BASIC/balanced_brackets.bas @@ -0,0 +1,57 @@ +DECLARE FUNCTION checkBrackets% (brackets AS STRING) +DECLARE FUNCTION generator$ (length AS INTEGER) + +RANDOMIZE TIMER + +DO + x$ = generator$ (10) + PRINT x$, + IF checkBrackets(x$) THEN + PRINT "OK" + ELSE + PRINT "NOT OK" + END IF +LOOP WHILE LEN(x$) + +FUNCTION checkBrackets% (brackets AS STRING) + 'returns -1 (TRUE) if everything's ok, 0 (FALSE) if not + DIM L0 AS INTEGER, sum AS INTEGER + + FOR L0 = 1 TO LEN(brackets) + SELECT CASE MID$(brackets, L0, 1) + CASE "[" + sum = sum + 1 + CASE "]" + sum = sum - 1 + END SELECT + IF sum < 0 THEN + checkBrackets% = 0 + EXIT FUNCTION + END IF + NEXT + + IF 0 = sum THEN + checkBrackets% = -1 + ELSE + checkBrackets% = 0 + END IF +END FUNCTION + +FUNCTION generator$ (length AS INTEGER) + z = INT(RND * length) + IF z < 1 THEN generator$ = "": EXIT FUNCTION + REDIM x(z * 2) AS STRING + FOR i = 0 TO z STEP 2 + x(i) = "[" + x(i + 1) = "]" + NEXT + FOR i = 1 TO UBOUND(x) + z = INT(RND * 2) + IF z THEN SWAP x(i), x(i - 1) + NEXT + xx$ = "" + FOR i = 0 TO UBOUND(x) + xx$ = xx$ + x(i) + NEXT + generator$ = xx$ +END FUNCTION diff --git a/Task/Balanced_brackets/Befunge/balanced_brackets.bf b/Task/Balanced_brackets/Befunge/balanced_brackets.bf new file mode 100644 index 0000000000..2264f098e0 --- /dev/null +++ b/Task/Balanced_brackets/Befunge/balanced_brackets.bf @@ -0,0 +1,7 @@ +v > "KO TON" ,,,,,, v +> ~ : 25*- #v_ $ | > 25*, @ + > "KO" ,, ^ + > : 1991+*+- #v_ v + > \ : 1991+*+- #v_v + \ $ +^ < <$< diff --git a/Task/Balanced_brackets/C/balanced_brackets-2.c b/Task/Balanced_brackets/C/balanced_brackets-2.c new file mode 100644 index 0000000000..3bf22f21e3 --- /dev/null +++ b/Task/Balanced_brackets/C/balanced_brackets-2.c @@ -0,0 +1,9 @@ +'': True +'[]': True +']][[': False +'[][][]': True +'[]][[]][': False +'[]][[[[]]]': False +']]]][[[]][[[': False +']]]]]][][[[[[[': False +'[][]][[][[[]]][]': False diff --git a/Task/Balanced_brackets/C/balanced_brackets.c b/Task/Balanced_brackets/C/balanced_brackets.c new file mode 100644 index 0000000000..3427dcb738 --- /dev/null +++ b/Task/Balanced_brackets/C/balanced_brackets.c @@ -0,0 +1,43 @@ +#include +#include +#include + +int isBal(const char*s,int l){ + signed c=0; + while(l--) + if(s[l]==']') ++c; + else if(s[l]=='[') if(--c<0) break; + return !c; +} + +void shuffle(char*s,int h){ + int x,t,i=h; + while(i--){ + t=s[x=rand()%h]; + s[x]=s[i]; + s[i]=t; + } +} + +void genSeq(char*s,int n){ + if(n){ + memset(s,'[',n); + memset(s+n,']',n); + shuffle(s,n*2); + } + s[n*2]=0; +} + +void doSeq(int n){ + char s[64]; + const char *o="False"; + genSeq(s,n); + if(isBal(s,n*2)) o="True"; + printf("'%s': %s\n",s,o); +} + +int main(){ + int n=0; + while(n<9) doSeq(n++); + return 0; +} diff --git a/Task/Balanced_brackets/Clojure/balanced_brackets.clj b/Task/Balanced_brackets/Clojure/balanced_brackets.clj new file mode 100644 index 0000000000..ebe2af1867 --- /dev/null +++ b/Task/Balanced_brackets/Clojure/balanced_brackets.clj @@ -0,0 +1,28 @@ +(defn gen-brackets [n] + (->> (concat (repeat n \[) (repeat n \])) + shuffle + (apply str ,))) + +(defn balanced? [s] + (loop [[first & coll] (seq s) + stack '()] + (if first + (if (= first \[) + (recur coll (conj stack \[)) + (when (= (peek stack) \[) + (recur coll (pop stack)))) + (zero? (count stack))))) + +user> (->> (range 10) + (map gen-brackets ,) + (map (juxt identity balanced?) ,) vec) +[["" true] + ["[]" true] + ["[[]]" true] + ["[][[]]" true] + ["[]][][][" nil] + ["[[[[[]]]]]" true] + ["]][[][][[[]]" nil] + ["[]]]][[[[]][][" nil] + ["][][[]]][[][][][" nil] + ["][][]]][]][[[][[[]" nil] diff --git a/Task/Balanced_brackets/CoffeeScript/balanced_brackets-2.coffee b/Task/Balanced_brackets/CoffeeScript/balanced_brackets-2.coffee new file mode 100644 index 0000000000..6cd1aec318 --- /dev/null +++ b/Task/Balanced_brackets/CoffeeScript/balanced_brackets-2.coffee @@ -0,0 +1,17 @@ +> coffee balanced.coffee +[[[[ false +[[[] false +[[][ false +[[]] true +[][[ false +[][] true +[]][ false +[]]] false +][[[ false +][[] false +][][ false +][]] false +]][[ false +]][] false +]]][ false +]]]] false diff --git a/Task/Balanced_brackets/CoffeeScript/balanced_brackets.coffee b/Task/Balanced_brackets/CoffeeScript/balanced_brackets.coffee new file mode 100644 index 0000000000..bf8c8bb817 --- /dev/null +++ b/Task/Balanced_brackets/CoffeeScript/balanced_brackets.coffee @@ -0,0 +1,15 @@ +isBalanced = (brackets) -> + openCount = 0 + for bracket in brackets + openCount += if bracket is '[' then 1 else -1 + return false if openCount < 0 + openCount is 0 + +bracketsCombinations = (n) -> + for i in [0...Math.pow 2, n] + str = i.toString 2 + str = '0' + str while str.length < n + str.replace(/0/g, '[').replace(/1/g, ']') + +for brackets in bracketsCombinations 4 + console.log brackets, isBalanced brackets diff --git a/Task/Balanced_brackets/Forth/balanced_brackets.fth b/Task/Balanced_brackets/Forth/balanced_brackets.fth new file mode 100644 index 0000000000..67263a368c --- /dev/null +++ b/Task/Balanced_brackets/Forth/balanced_brackets.fth @@ -0,0 +1,23 @@ +include lib/choose.4th ( n1 -- n2) +include lib/ctos.4th ( n -- a 1) + + 10 constant /[] \ maximum number of brackets +/[] string [] \ string with brackets + \ create string with brackets +: make[] ( --) + 0 dup [] place /[] choose 0 ?do 2 choose 2* [char] [ + c>s [] +place loop +; \ empty string, fill with brackets + \ evaluate string +: eval[] ( --) + [] count 2dup over chars + >r swap type 0 + begin \ setup string and count + over r@ < \ reached end of string? + while \ if not .. + dup 0< 0= \ unbalanced ]? + while \ if not .. + over c@ [char] \ - negate + swap char+ swap + repeat \ evaluate, goto next character + r> drop if ." NOT" then ." OK" cr drop +; \ evaluate string and print result + +make[] eval[] diff --git a/Task/Balanced_brackets/Go/balanced_brackets.go b/Task/Balanced_brackets/Go/balanced_brackets.go new file mode 100644 index 0000000000..d3354589e8 --- /dev/null +++ b/Task/Balanced_brackets/Go/balanced_brackets.go @@ -0,0 +1,55 @@ +package main + +import ( + "bytes" + "fmt" + "math/rand" + "time" +) + +func init() { + rand.Seed(time.Now().UnixNano()) +} + +func generate(n uint) string { + a := bytes.Repeat([]byte("[]"), int(n)) + for i := len(a) - 1; i >= 1; i-- { + j := rand.Intn(i + 1) + a[i], a[j] = a[j], a[i] + } + return string(a) +} + +func testBalanced(s string) { + fmt.Printf("%s: ", s) + var open int + for i := 0; i < len(s); i++ { + switch s[i] { + case '[': + open++ + case ']': + if open == 0 { + fmt.Println("not ok") + return + + } + open-- + default: + fmt.Println("not ok") + return + } + } + if open == 0 { + fmt.Println("ok") + } else { + fmt.Println("not ok") + } +} + +func main() { + rand.Seed(time.Now().UnixNano()) + for i := uint(0); i < 10; i++ { + testBalanced(generate(i)) + } + testBalanced("()") +} diff --git a/Task/Balanced_brackets/Haskell/balanced_brackets-2.hs b/Task/Balanced_brackets/Haskell/balanced_brackets-2.hs new file mode 100644 index 0000000000..d60d6fe8e7 --- /dev/null +++ b/Task/Balanced_brackets/Haskell/balanced_brackets-2.hs @@ -0,0 +1,20 @@ +module VShuffle (shuffle) where + +import Data.List (mapAccumL) +import System.Random +import Control.Monad.ST +import qualified Data.Vector as V +import qualified Data.Vector.Generic.Mutable as M + +-- Generate a list of array index pairs, each corresponding to a swap. +pairs :: (Enum a, Random a, RandomGen g) => a -> a -> g -> [(a, a)] +pairs l u r = snd $ mapAccumL step r [l..pred u] + where step r i = let (j, r') = randomR (i, u) r in (r', (i, j)) + +-- Return a random permutation of the list. We use the algorithm described in +-- http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm. +shuffle :: (RandomGen g) => [a] -> g -> [a] +shuffle xs r = V.toList . runST $ do + v <- V.unsafeThaw $ V.fromList xs + mapM_ (uncurry $ M.swap v) $ pairs 0 (M.length v - 1) r + V.unsafeFreeze v diff --git a/Task/Balanced_brackets/Haskell/balanced_brackets.hs b/Task/Balanced_brackets/Haskell/balanced_brackets.hs new file mode 100644 index 0000000000..0cfa89c906 --- /dev/null +++ b/Task/Balanced_brackets/Haskell/balanced_brackets.hs @@ -0,0 +1,29 @@ +import Control.Monad +import System.Random +import Text.Printf +import VShuffle + +-- Return whether a string contains balanced brackets. Nothing indicates a +-- balanced string, while (Just i) means an imbalance was found at, or just +-- after, the i'th bracket. We assume the string contains only brackets. +isBalanced :: String -> Maybe Int +isBalanced = bal (-1) 0 + where bal :: Int -> Int -> String -> Maybe Int + bal _ 0 [] = Nothing + bal i _ [] = Just i + bal i (-1) _ = Just i + bal i n ('[':bs) = bal (i+1) (n+1) bs + bal i n (']':bs) = bal (i+1) (n-1) bs + +-- Print a string, indicating whether it contains balanced brackets. If not, +-- indicate the bracket at which the imbalance was found. +check :: String -> IO () +check s = maybe (good s) (bad s) (isBalanced s) + where good s = printf "Good \"%s\"\n" s + bad s n = printf "Bad \"%s\"\n%*s^\n" s (n+6) " " + +main :: IO () +main = do + let bs = cycle "[]" + rs <- replicateM 10 newStdGen + zipWithM_ (\n r -> check $ shuffle (take n bs) r) [0,2..] rs diff --git a/Task/Balanced_brackets/Java/balanced_brackets.java b/Task/Balanced_brackets/Java/balanced_brackets.java new file mode 100644 index 0000000000..66e53534f7 --- /dev/null +++ b/Task/Balanced_brackets/Java/balanced_brackets.java @@ -0,0 +1,50 @@ +public class Brackets { + public static boolean checkBrackets(String str){ + int mismatchedBrackets = 0; + for(char ch:str.toCharArray()){ + if(ch == '['){ + mismatchedBrackets++; + }else if(ch == ']'){ + mismatchedBrackets--; + }else{ + return false; //non-bracket chars + } + if(mismatchedBrackets < 0){ //close bracket before open bracket + return false; + } + } + return mismatchedBrackets == 0; + } + + public static String generate(int n){ + if(n % 2 == 1){ //if n is odd we can't match brackets + return null; + } + String ans = ""; + int openBracketsLeft = n / 2; + int unclosed = 0; + while(ans.length() < n){ + if(Math.random() >= .5 && openBracketsLeft > 0 || unclosed == 0){ + ans += '['; + openBracketsLeft--; + unclosed++; + }else{ + ans += ']'; + unclosed--; + } + } + return ans; + } + + public static void main(String[] args){ + String[] tests = {"", "[]", "][", "[][]", "][][", "[[][]]", "[]][[]"}; + for(int i = 0; i <= 16; i+=2){ + String bracks = generate(i); + System.out.println(bracks + ": " + checkBrackets(bracks)); + } + + for(String test: tests){ + System.out.println(test + ": " + checkBrackets(test)); + } + } +} diff --git a/Task/Balanced_brackets/JavaScript/balanced_brackets-2.js b/Task/Balanced_brackets/JavaScript/balanced_brackets-2.js new file mode 100644 index 0000000000..7f6f2b1ff7 --- /dev/null +++ b/Task/Balanced_brackets/JavaScript/balanced_brackets-2.js @@ -0,0 +1,29 @@ +function checkBalance(i) { + while (i.length % 2 == 0) { + j = i.replace('{}',''); + if (j == i) + break; + i = j; + } + return (i?false:true); +} + +var g = 10; +while (g--) { + var N = 10 - Math.floor(g/2), n=N, o=''; + while (n || N) { + if (N == 0 || n == 0) { + o+=Array(++N).join('}') + Array(++n).join('{'); + break; + } + if (Math.round(Math.random()) == 1) { + o+='}'; + N--; + } + else { + o+='{'; + n--; + } + } + alert(o+": "+checkBalance(o)); +} diff --git a/Task/Balanced_brackets/JavaScript/balanced_brackets.js b/Task/Balanced_brackets/JavaScript/balanced_brackets.js new file mode 100644 index 0000000000..3c8c523386 --- /dev/null +++ b/Task/Balanced_brackets/JavaScript/balanced_brackets.js @@ -0,0 +1,43 @@ +function createRandomBracketSequence(maxlen) +{ + var chars = { '0' : '[' , '1' : ']' }; + function getRandomInteger(to) + { + return Math.floor(Math.random() * (to+1)); + } + var n = getRandomInteger(maxlen); + var result = []; + for(var i = 0; i < n; i++) + { + result.push(chars[getRandomInteger(1)]); + } + return result.join(""); +} + +function bracketsAreBalanced(s) +{ + var open = (arguments.length > 1) ? arguments[1] : '['; + var close = (arguments.length > 2) ? arguments[2] : ']'; + var c = 0; + for(var i = 0; i < s.length; i++) + { + var ch = s.charAt(i); + if ( ch == open ) + { + c++; + } + else if ( ch == close ) + { + c--; + if ( c < 0 ) return false; + } + } + return c == 0; +} + +var c = 0; +while ( c < 5 ) { + var seq = createRandomBracketSequence(8); + alert(seq + ':\t' + bracketsAreBalanced(seq)); + c++; +} diff --git a/Task/Balanced_brackets/Lua/balanced_brackets.lua b/Task/Balanced_brackets/Lua/balanced_brackets.lua new file mode 100644 index 0000000000..54764a5b25 --- /dev/null +++ b/Task/Balanced_brackets/Lua/balanced_brackets.lua @@ -0,0 +1,20 @@ +function isBalanced(s) + --Lua pattern matching has a 'balanced' pattern that matches sets of balanced characters. + --Any two characters can be used. + return s:gsub('%b[]','')=='' and true or false +end + +function randomString() + math.randomseed(os.time()) + math.random()math.random()math.random()math.random() + local tokens={'[',']'} + local result={} + for i=1,8 do + table.insert(result,tokens[math.random(1,2)]) + end + return table.concat(result) +end + +local RS=randomString() +print(RS) +print(isBalanced(RS)) diff --git a/Task/Balanced_brackets/Perl/balanced_brackets-2.pl b/Task/Balanced_brackets/Perl/balanced_brackets-2.pl new file mode 100644 index 0000000000..0ee712dcc8 --- /dev/null +++ b/Task/Balanced_brackets/Perl/balanced_brackets-2.pl @@ -0,0 +1,10 @@ +use 5.10.0; # for '++' non-backtrack behavior +sub balanced { + my $_ = shift; + s/(\[(?:[^\[\]]++|(?1))*\])//g; + ! /[\[\]]/; +} + +for (']', '[', '[[]', '][]', '[[]]', '[[]]]][][]]', 'x[ y [ [] z ]][ 1 ][]abcd') { + print balanced($_) ? "" : "not ", "balanced:\t'$_'\n"; +} diff --git a/Task/Balanced_brackets/Perl/balanced_brackets.pl b/Task/Balanced_brackets/Perl/balanced_brackets.pl new file mode 100644 index 0000000000..f629496158 --- /dev/null +++ b/Task/Balanced_brackets/Perl/balanced_brackets.pl @@ -0,0 +1,13 @@ +use 5.10.0; # for given ... when construct +sub balanced { + my $depth = 0; + for (split //, shift) { + when('[') { ++$depth } + when(']') { return if --$depth < 0 } + } + return !$depth +} + +for (']', '[', '[[]', '][]', '[[]]', '[[]]]][][]]', 'x[ y [ [] z ]][ 1 ][]abcd') { + print balanced($_) ? "" : "not ", "balanced:\t'$_'\n"; +} diff --git a/Task/Balanced_brackets/PicoLisp/balanced_brackets.l b/Task/Balanced_brackets/PicoLisp/balanced_brackets.l new file mode 100644 index 0000000000..4df0137cd6 --- /dev/null +++ b/Task/Balanced_brackets/PicoLisp/balanced_brackets.l @@ -0,0 +1,17 @@ +(load "@lib/simul.l") # For 'shuffle' + +(de generateBrackets (N) + (shuffle (make (do N (link "[" "]")))) ) + +(de checkBrackets (S) + (let N 0 + (for C S + (if (= C "[") + (inc 'N) + (if2 (= C "]") (=0 N) + (off N) + (dec 'N) ) ) ) + (=0 N) ) ) + +(for N 10 + (prinl (if (checkBrackets (prin (generateBrackets N))) " OK" "not OK")) ) diff --git a/Task/Balanced_brackets/Prolog/balanced_brackets.pro b/Task/Balanced_brackets/Prolog/balanced_brackets.pro new file mode 100644 index 0000000000..fbcbbdf67d --- /dev/null +++ b/Task/Balanced_brackets/Prolog/balanced_brackets.pro @@ -0,0 +1,52 @@ +rosetta_brackets :- + test_brackets([]), + test_brackets(['[',']']), + test_brackets(['[',']','[',']']), + test_brackets(['[','[',']','[',']',']']), + test_brackets([']','[']), + test_brackets([']','[',']','[']), + test_brackets(['[',']',']','[','[',']']). + +balanced_brackets :- + gen_bracket(2, B1, []), test_brackets(B1), + gen_bracket(4, B2, []), test_brackets(B2), + gen_bracket(4, B3, []), test_brackets(B3), + gen_bracket(6, B4, []), test_brackets(B4), + gen_bracket(6, B5, []), test_brackets(B5), + gen_bracket(8, B6, []), test_brackets(B6), + gen_bracket(8, B7, []), test_brackets(B7), + gen_bracket(10, B8, []), test_brackets(B8), + gen_bracket(10, B9, []), test_brackets(B9). + +test_brackets(Goal) :- + ( Goal = [] -> write('(empty)'); maplist(write, Goal)), + ( balanced_brackets(Goal, []) -> + writeln(' succeed') + ; + writeln(' failed') + ). + +% grammar of balanced brackets +balanced_brackets --> []. + +balanced_brackets --> + ['['], + balanced_brackets, + [']']. + +balanced_brackets --> + ['[',']'], + balanced_brackets. + + +% generator of random brackets +gen_bracket(0) --> []. + +gen_bracket(N) --> + {N1 is N - 1, + R is random(2)}, + bracket(R), + gen_bracket(N1). + +bracket(0) --> ['[']. +bracket(1) --> [']']. diff --git a/Task/Balanced_brackets/Python/balanced_brackets.py b/Task/Balanced_brackets/Python/balanced_brackets.py new file mode 100644 index 0000000000..b58f162dfb --- /dev/null +++ b/Task/Balanced_brackets/Python/balanced_brackets.py @@ -0,0 +1,27 @@ +>>> def gen(N): +... txt = ['[', ']'] * N +... random.shuffle( txt ) +... return ''.join(txt) +... +>>> def balanced(txt): +... braced = 0 +... for ch in txt: +... if ch == '[': braced += 1 +... if ch == ']': +... braced -= 1 +... if braced < 0: return False +... return braced == 0 +... +>>> for txt in (gen(N) for N in range(10)): +... print ("%-22r is%s balanced" % (txt, '' if balanced(txt) else ' not')) +... +'' is balanced +'[]' is balanced +'[][]' is balanced +'][[[]]' is not balanced +'[]][[][]' is not balanced +'[][[][]]][' is not balanced +'][]][][[]][[' is not balanced +'[[]]]]][]][[[[' is not balanced +'[[[[]][]]][[][]]' is balanced +'][[][[]]][]]][[[[]' is not balanced diff --git a/Task/Balanced_brackets/R/balanced_brackets-2.r b/Task/Balanced_brackets/R/balanced_brackets-2.r new file mode 100644 index 0000000000..7b38727c93 --- /dev/null +++ b/Task/Balanced_brackets/R/balanced_brackets-2.r @@ -0,0 +1,3 @@ +balanced <- function(str) { + regexpr('^(\\[(?1)*\\])*$', str, perl=TRUE) > -1 +} diff --git a/Task/Balanced_brackets/R/balanced_brackets-3.r b/Task/Balanced_brackets/R/balanced_brackets-3.r new file mode 100644 index 0000000000..044416269f --- /dev/null +++ b/Task/Balanced_brackets/R/balanced_brackets-3.r @@ -0,0 +1,6 @@ +rand.parens <- function(n) paste(permute(c(rep('[',n),rep(']',n))),collapse="") + +as.data.frame(within(list(), { + parens <- replicate(10, rand.parens(sample.int(10,size=1))) + balanced <- sapply(parens, balanced) +})) diff --git a/Task/Balanced_brackets/R/balanced_brackets-4.r b/Task/Balanced_brackets/R/balanced_brackets-4.r new file mode 100644 index 0000000000..834dd2fa79 --- /dev/null +++ b/Task/Balanced_brackets/R/balanced_brackets-4.r @@ -0,0 +1,11 @@ + balanced parens +1 FALSE ][][ +2 FALSE [][[]]][[]][]]][[[ +3 FALSE ][[][][]][][[] +4 FALSE ][][][][][][][ +5 TRUE [[[][]]][[[][][]]] +6 TRUE [] +7 FALSE ]][[][[] +8 FALSE []]]][[[]][[[] +9 TRUE [[[[][[][]]]]] +10 TRUE [] diff --git a/Task/Balanced_brackets/R/balanced_brackets.r b/Task/Balanced_brackets/R/balanced_brackets.r new file mode 100644 index 0000000000..45503a5d9d --- /dev/null +++ b/Task/Balanced_brackets/R/balanced_brackets.r @@ -0,0 +1,5 @@ +balanced <- function(str){ + str <- strsplit(str, "")[[1]] + str <- ifelse(str=='[', 1, -1) + all(cumsum(str) >= 0) && sum(str) == 0 +} diff --git a/Task/Balanced_brackets/REXX/balanced_brackets-2.rexx b/Task/Balanced_brackets/REXX/balanced_brackets-2.rexx new file mode 100644 index 0000000000..056750d32b --- /dev/null +++ b/Task/Balanced_brackets/REXX/balanced_brackets-2.rexx @@ -0,0 +1,67 @@ +/*REXX program to check for balanced brackets [] ********************** +* test strings and random string generation copied from Version 1 +* the rest restructured (shortened) to some extent +* and output made reproducible (random with a seed) +* 10.07.2012 Walter Pachl +**********************************************************************/ +yesno.0 = 'unbalanced' +yesno.1 = ' balanced' +done.=0 /* memory what's been done */ +n=0 /* number of tests */ +Call testbal '[][][][[]]' /* first some user written tests */ +Call testbal '[][][][[]]][' +Call testbal '[' +Call testbal ']' +Call testbal '[]' +Call testbal '][' +Call testbal '][][' +Call testbal '[[]]' +Call testbal '[[[[[[[]]]]]]]' +Call testbal '[[[[[]]]][]' +Call testbal '[][]' +Call testbal '[]][[]' +Call testbal ']]][[[[]' +Call testbal ']' +Call testbal '[' + /* then some random generated ones */ +Call random 1,2,12345 /* call random with a seed */ + /* makes test reproducible */ +do Until n=30 /* up to 30 tests */ + s=rand(random(1,8)) /* a 01 etc. string of length 4-32 */ + q=translate(s,'[]',01) /* turn digits into brackets */ + if done.q then /* string was already here */ + iterate /* don't test again */ + call testbal q /* test balance */ + End +exit + +testbal: /* test the given string and show result */ + n=n+1 /* number of tests */ + Parse Arg q /* get string to be tested */ + done.q=1 /* mark as done */ + call checkBal q /* test balance */ + lq=format(length(q),2) + say right(n,2) lq yesno.result q/* show result and string */ + Return + +/*-----------------------------------PAND subroutine-----------------*/ +pand: p=random(0,1); return p || \p +/*-----------------------------------RAND subroutine-----------------*/ +rand: pp=pand(); pp=pand()pp; pp=copies(pp,arg(1)) + i=random(2,length(pp)); pp=left(pp,i-1)substr(pp,i) +return pp + +checkBal: procedure /*check for balanced brackets () */ + Parse arg y + nest=0; + do While y<>'' + Parse Var y c +1 y /*pick off one character at a time */ + if c='[' then /* opening bracket */ + nest=nest+1 /* increment nesting */ + else do /* closing bracket */ + if nest=0 then /* not allowed */ + return 0; /* no success */ + nest=nest-1 /* decrement nesting */ + end + end + return nest=0 /* nest=0 -> balanced */ diff --git a/Task/Balanced_brackets/REXX/balanced_brackets-3.rexx b/Task/Balanced_brackets/REXX/balanced_brackets-3.rexx new file mode 100644 index 0000000000..6fd119ca3d --- /dev/null +++ b/Task/Balanced_brackets/REXX/balanced_brackets-3.rexx @@ -0,0 +1,58 @@ +/*REXX program to check for balanced brackets [ ] */ +count=0 +nested=0 +yesno.0 = left('',40) 'unbalanced' +yesno.1 = 'balanced' +q='' ; call checkBal q; say yesno.result q +q='[][][][[]]' ; call checkBal q; say yesno.result q +q='[][][][[]]][' ; call checkBal q; say yesno.result q +q='[' ; call checkBal q; say yesno.result q +q=']' ; call checkBal q; say yesno.result q +q='[]' ; call checkBal q; say yesno.result q +q='][' ; call checkBal q; say yesno.result q +q='][][' ; call checkBal q; say yesno.result q +q='[[]]' ; call checkBal q; say yesno.result q +q='[[[[[[[]]]]]]]' ; call checkBal q; say yesno.result q +q='[[[[[]]]][]' ; call checkBal q; say yesno.result q +q='[][]' ; call checkBal q; say yesno.result q +q='[]][[]' ; call checkBal q; say yesno.result q +q=']]][[[[]' ; call checkBal q; say yesno.result q +call teller +count=0 +nested=0 + do j=1 /*generate lots of permutations. */ + q=translate(strip(x2b(d2x(j)),'L',0),"][",01) /*convert──►[].*/ + if countstr(']',q)\==countstr('[',q) then iterate /*compliant?*/ + call checkBal q + if length(q)>20 then leave /*done all 20-char possibilities?*/ + end +/*───────────────────────────────────TELLER subroutine──────────────────*/ +teller: say +say count " expressions were checked, " nested ' were balanced, ', + count-nested " were unbalanced." +return +/*───────────────────────────────────CHECKBAL subroutine────────────────*/ +checkBal: procedure expose nested count; parse arg y; count=count+1 +nest=0 + do j=1 for length(y); _=substr(y,j,1) /*pick off character.*/ + select + when _=='[' then nest=nest+1 /*opening bracket ...*/ + when _==']' then do; nest=nest-1; if nest<0 then leave; end + otherwise nop /*ignore any chaff. */ + end /*select*/ + end /*j*/ +nested=nested + (nest==0) +return nest==0 +/* ┌──────────────────────────────────────────────────────────────────┐ + │ COUNTSTR counts the number of occurances of a string (or char)│ + │ within another string (haystack) without overlap. If either arg │ + │ is null, 0 (zero) is returned. To make the subroutine case │ + │ insensative, change the PARSE ARG ... statement to ARG ... │ + │ Example: yyy = 'The quick brown fox jumped over the lazy dog.' │ + │ zz = countstr('o',yyy) /*ZZ will be set to 4 */ │ + │ Note that COUNTSTR is also a built-in function of the newer │ + │ REXX interpreters, and the result should be identical. Checks │ + │ could be added to validate if 2 or 3 arguments are passed. │ + └──────────────────────────────────────────────────────────────────┘ */ +countstr: procedure; parse arg n,h,s; if s=='' then s=1; w=length(n) + do r=0 until _==0; _=pos(n,h,s); s=_+w; end; return r diff --git a/Task/Balanced_brackets/REXX/balanced_brackets.rexx b/Task/Balanced_brackets/REXX/balanced_brackets.rexx new file mode 100644 index 0000000000..22766fafbf --- /dev/null +++ b/Task/Balanced_brackets/REXX/balanced_brackets.rexx @@ -0,0 +1,40 @@ +/*REXX program to check for balanced brackets [] */ +@.=0 +yesno.0 = left('',40) 'unbalanced' +yesno.1 = 'balanced' + +q='[][][][[]]' ; call checkBal q; say yesno.result q +q='[][][][[]]][' ; call checkBal q; say yesno.result q +q='[' ; call checkBal q; say yesno.result q +q=']' ; call checkBal q; say yesno.result q +q='[]' ; call checkBal q; say yesno.result q +q='][' ; call checkBal q; say yesno.result q +q='][][' ; call checkBal q; say yesno.result q +q='[[]]' ; call checkBal q; say yesno.result q +q='[[[[[[[]]]]]]]' ; call checkBal q; say yesno.result q +q='[[[[[]]]][]' ; call checkBal q; say yesno.result q +q='[][]' ; call checkBal q; say yesno.result q +q='[]][[]' ; call checkBal q; say yesno.result q +q=']]][[[[]' ; call checkBal q; say yesno.result q + + do j=1 for 40 + q=translate(rand(random(1,8)),'[]',01) + call checkBal q; if result=='-1' then iterate + say yesno.result q + end +exit +/*───────────────────────────────────PAND subroutine────────────────────*/ +pand: p=random(0,1); return p || \p +/*───────────────────────────────────RAND subroutine────────────────────*/ +rand: pp=pand(); pp=pand()pp; pp=copies(pp,arg(1)) + i=random(2,length(pp)); pp=left(pp,i-1)substr(pp,i) +return pp +/*───────────────────────────────────CHECKBAL subroutine────────────────*/ +checkBal: procedure expose @.; arg y /*check for balanced brackets [] */ +nest=0; if @.y then return '-1' /*already done this expression ? */ +@.y=1 /*indicate expression processed. */ + do j=1 for length(y); _=substr(y,j,1) /*pick off character.*/ + if _=='[' then nest=nest+1 + else do; nest=nest-1; if nest<0 then return 0; end + end /*j*/ +return nest==0 diff --git a/Task/Balanced_brackets/Racket/balanced_brackets.rkt b/Task/Balanced_brackets/Racket/balanced_brackets.rkt new file mode 100644 index 0000000000..ae5071a590 --- /dev/null +++ b/Task/Balanced_brackets/Racket/balanced_brackets.rkt @@ -0,0 +1,17 @@ +#lang racket + +(define (generate n) + (list->string (shuffle (append* (make-list n '(#\[ #\])))))) + +(define (balanced? str) + (let loop ([l (string->list str)] [n 0]) + (or (null? l) + (if (eq? #\[ (car l)) + (loop (cdr l) (add1 n)) + (and (> n 0) (loop (cdr l) (sub1 n))))))) + +(define (try n) + (define s (generate n)) + (printf "~a => ~a\n" s (if (balanced? s) "OK" "NOT OK"))) + +(for ([n 10]) (try n)) diff --git a/Task/Balanced_brackets/Ruby/balanced_brackets.rb b/Task/Balanced_brackets/Ruby/balanced_brackets.rb new file mode 100644 index 0000000000..3a94339a72 --- /dev/null +++ b/Task/Balanced_brackets/Ruby/balanced_brackets.rb @@ -0,0 +1,24 @@ +re = /\A # beginning of string + (? # begin capture group + \[ # literal [ + \g* # zero or more + \] # literal ] + )* # end group, zero or more such groups +\z/x # end of string + +(0..9).each do |i| + s = "[]" * i + + # There is no String#shuffle! method. + # This is a Knuth shuffle. + (s.length - 1).downto(1) do |a; b| + b = rand(a + 1) + s[a], s[b] = s[b], s[a] + end + + puts((s =~ re ? " OK: " : "bad: ") + s) +end + +["[[]", "[]]", "[letters]"].each do |s| + puts((s =~ re ? " OK: " : "bad: ") + s) +end diff --git a/Task/Balanced_brackets/Scala/balanced_brackets.scala b/Task/Balanced_brackets/Scala/balanced_brackets.scala new file mode 100644 index 0000000000..9a94614921 --- /dev/null +++ b/Task/Balanced_brackets/Scala/balanced_brackets.scala @@ -0,0 +1,36 @@ +import scala.collection.mutable.ListBuffer +import scala.util.Random + +object BalancedBrackets extends App { + + val random = new Random() + def generateRandom: List[String] = { + import scala.util.Random._ + val shuffleIt: Int => String = i => shuffle(("["*i+"]"*i).toList).foldLeft("")(_+_) + (1 to 20).map(i=>(random.nextDouble*100).toInt).filter(_>2).map(shuffleIt(_)).toList + } + + def generate(n: Int): List[String] = { + val base = "["*n+"]"*n + var lb = ListBuffer[String]() + base.permutations.foreach(s=>lb+=s) + lb.toList.sorted + } + + def checkBalance(brackets: String):Boolean = { + def balI(brackets: String, depth: Int):Boolean = { + if (brackets == "") depth == 0 + else brackets(0) match { + case '[' => ((brackets.size > 1) && balI(brackets.substring(1), depth + 1)) + case ']' => (depth > 0) && ((brackets.size == 1) || balI(brackets.substring(1), depth -1)) + case _ => false + } + } + balI(brackets, 0) + } + + println("arbitrary random order:") + generateRandom.map(s=>Pair(s,checkBalance(s))).foreach(p=>println((if(p._2) "balanced: " else "unbalanced: ")+p._1)) + println("\n"+"check all permutations of given length:") + (1 to 5).map(generate(_)).flatten.map(s=>Pair(s,checkBalance(s))).foreach(p=>println((if(p._2) "balanced: " else "unbalanced: ")+p._1)) +} diff --git a/Task/Balanced_brackets/Scheme/balanced_brackets.ss b/Task/Balanced_brackets/Scheme/balanced_brackets.ss new file mode 100644 index 0000000000..d4c36dd866 --- /dev/null +++ b/Task/Balanced_brackets/Scheme/balanced_brackets.ss @@ -0,0 +1,23 @@ +(define (balanced-brackets string) + (define (b chars sum) + (cond ((and (null? chars) (= 0 sum)) + #t) + ((null? chars) + #f) + ((char=? #\[ (car chars)) + (b (cdr chars) (+ sum 1))) + ((= sum 0) + #f) + (else + (b (cdr chars) (- sum 1))))) + (b (string->list string) 0)) + +(balanced-brackets "") + +(balanced-brackets "[]") +(balanced-brackets "[][]") +(balanced-brackets "[[][]]") + +(balanced-brackets "][") +(balanced-brackets "][][") +(balanced-brackets "[]][[]") diff --git a/Task/Balanced_brackets/Tcl/balanced_brackets-2.tcl b/Task/Balanced_brackets/Tcl/balanced_brackets-2.tcl new file mode 100644 index 0000000000..f01beac2ea --- /dev/null +++ b/Task/Balanced_brackets/Tcl/balanced_brackets-2.tcl @@ -0,0 +1,8 @@ +proc constructBalancedString {n} { + set s "" + for {set i 0} {$i < $n} {incr i} { + set x [expr {int(rand() * ([string length $s] + 1))}] + set s "[string range $s 0 [expr {$x-1}]]\[\][string range $s $x end]" + } + return $s +} diff --git a/Task/Balanced_brackets/Tcl/balanced_brackets.tcl b/Task/Balanced_brackets/Tcl/balanced_brackets.tcl new file mode 100644 index 0000000000..82d7ece066 --- /dev/null +++ b/Task/Balanced_brackets/Tcl/balanced_brackets.tcl @@ -0,0 +1,28 @@ +proc generate {n} { + if {!$n} return + set l [lrepeat $n "\[" "\]"] + set len [llength $l] + while {$len} { + set tmp [lindex $l [set i [expr {int($len * rand())}]]] + lset l $i [lindex $l [incr len -1]] + lset l $len $tmp + } + return [join $l ""] +} + +proc balanced s { + set n 0 + foreach c [split $s ""] { + # Everything unmatched is ignored, which is what we want + switch -exact -- $c { + "\[" {incr n} + "\]" {if {[incr n -1] < 0} {return false}} + } + } + expr {!$n} +} + +for {set i 0} {$i < 15} {incr i} { + set s [generate $i] + puts "\"$s\"\t-> [expr {[balanced $s] ? {OK} : {NOT OK}}]" +} diff --git a/Task/Balanced_ternary/0DESCRIPTION b/Task/Balanced_ternary/0DESCRIPTION new file mode 100644 index 0000000000..1cde069ec4 --- /dev/null +++ b/Task/Balanced_ternary/0DESCRIPTION @@ -0,0 +1,16 @@ +[[wp:Balanced ternary|Balanced ternary]] is a way of representing numbers. Unlike the prevailing binary representation, a balanced ternary integer is in base 3, and each digit can have the values 1, 0, or −1. For example, decimal 11 = 32 + 31 − 30, thus can be written as "++−", while 6 = 32 − 31 + 0 × 30, i.e., "+−0". + +For this task, implement balanced ternary representation of integers with the following + +'''Requirements''' +# Support arbitrarily large integers, both positive and negative; +# Provide ways to convert to and from text strings, using digits '+', '-' and '0' (unless you are already using strings to represent balanced ternary; but see requirement 5). +# Provide ways to convert to and from native integer type (unless, improbably, your platform's native integer type ''is'' balanced ternary). If your native integers can't support arbitrary length, overflows during conversion must be indicated. +# Provide ways to perform addition, negation and multiplication directly on balanced ternary integers; do ''not'' convert to native integers first. +# Make your implementation efficient, with a reasonable definition of "effcient" (and with a reasonable definition of "reasonable"). + +'''Test case''' With balanced ternaries ''a'' from string "+-0++0+", ''b'' from native integer -436, ''c'' "+-++-": +* write out ''a'', ''b'' and ''c'' in decimal notation; +* calculate ''a'' × (''b'' − ''c''), write out the result in both ternary and decimal notations. + +'''Note:''' The pages [[generalised floating point addition]] and [[generalised floating point multiplication]] have code implementing [[wp:arbitrary precision|arbitrary precision]] [[wp:floating point|floating point]] balanced ternary. diff --git a/Task/Balanced_ternary/Erlang/balanced_ternary-2.erl b/Task/Balanced_ternary/Erlang/balanced_ternary-2.erl new file mode 100644 index 0000000000..ae6d176738 --- /dev/null +++ b/Task/Balanced_ternary/Erlang/balanced_ternary-2.erl @@ -0,0 +1,6 @@ +234> ternary:test(). +A = +-0++0+ -> 523 +B = -++-0-- -> -436 +C = +-++- -> 65 +A x (B - C) = 0----0+--0++0 -> -262023 +ok diff --git a/Task/Balanced_ternary/Erlang/balanced_ternary.erl b/Task/Balanced_ternary/Erlang/balanced_ternary.erl new file mode 100644 index 0000000000..c1acdcc270 --- /dev/null +++ b/Task/Balanced_ternary/Erlang/balanced_ternary.erl @@ -0,0 +1,89 @@ +-module(ternary). +-compile(export_all). + +test() -> + AS = "+-0++0+", AT = from_string(AS), A = from_ternary(AT), + B = -436, BT = to_ternary(B), BS = to_string(BT), + CS = "+-++-", CT = from_string(CS), C = from_ternary(CT), + RT = mul(AT,sub(BT,CT)), + R = from_ternary(RT), + RS = to_string(RT), + io:fwrite("A = ~s -> ~b~n",[AS, A]), + io:fwrite("B = ~s -> ~b~n",[BS, B]), + io:fwrite("C = ~s -> ~b~n",[CS, C]), + io:fwrite("A x (B - C) = ~s -> ~b~n", [RS, R]). + +to_string(T) -> [to_char(X) || X <- T]. + +from_string(S) -> [from_char(X) || X <- S]. + +to_char(-1) -> $-; +to_char(0) -> $0; +to_char(1) -> $+. + +from_char($-) -> -1; +from_char($0) -> 0; +from_char($+) -> 1. + +to_ternary(N) when N > 0 -> + to_ternary(N,[]); +to_ternary(N) -> + neg(to_ternary(-N)). + +to_ternary(0,Acc) -> + Acc; +to_ternary(N,Acc) when N rem 3 == 0 -> + to_ternary(N div 3, [0|Acc]); +to_ternary(N,Acc) when N rem 3 == 1 -> + to_ternary(N div 3, [1|Acc]); +to_ternary(N,Acc) -> + to_ternary((N+1) div 3, [-1|Acc]). + +from_ternary(T) -> from_ternary(T,0). + +from_ternary([],Acc) -> + Acc; +from_ternary([H|T],Acc) -> + from_ternary(T,Acc*3 + H). + +mul(A,B) -> mul(B,A,[]). + +mul(_,[],Acc) -> + Acc; +mul(B,[A|As],Acc) -> + BP = case A of + -1 -> neg(B); + 0 -> [0]; + 1 -> B + end, + A1 = Acc++[0], + A2=add(BP,A1), + mul(B,As,A2). + + +neg(T) -> [ -H || H <- T]. + +sub(A,B) -> add(A,neg(B)). + +add(A,B) when length(A) < length(B) -> + add(lists:duplicate(length(B)-length(A),0)++A,B); +add(A,B) when length(A) > length(B) -> + add(B,A); +add(A,B) -> + add(lists:reverse(A),lists:reverse(B),0,[]). + +add([],[],0,Acc) -> + Acc; +add([],[],C,Acc) -> + [C|Acc]; +add([A|As],[B|Bs],C,Acc) -> + [C1,D] = add_util(A+B+C), + add(As,Bs,C1,[D|Acc]). + +add_util(-3) -> [-1,0]; +add_util(-2) -> [-1,1]; +add_util(-1) -> [0,-1]; +add_util(3) -> [1,0]; +add_util(2) -> [1,-1]; +add_util(1) -> [0,1]; +add_util(0) -> [0,0]. diff --git a/Task/Balanced_ternary/Go/balanced_ternary.go b/Task/Balanced_ternary/Go/balanced_ternary.go new file mode 100644 index 0000000000..533390de65 --- /dev/null +++ b/Task/Balanced_ternary/Go/balanced_ternary.go @@ -0,0 +1,224 @@ +package main + +import ( + "fmt" + "strings" +) + +// R1: representation is a slice of int8 digits of -1, 0, or 1. +// digit at index 0 is least significant. zero value of type is +// representation of the number 0. +type bt []int8 + +// R2: string conversion: + +// btString is a constructor. valid input is a string of any length +// consisting of only '+', '-', and '0' characters. +// leading zeros are allowed but are trimmed and not represented. +// false return means input was invalid. +func btString(s string) (*bt, bool) { + s = strings.TrimLeft(s, "0") + b := make(bt, len(s)) + for i, last := 0, len(s)-1; i < len(s); i++ { + switch s[i] { + case '-': + b[last-i] = -1 + case '0': + b[last-i] = 0 + case '+': + b[last-i] = 1 + default: + return nil, false + } + } + return &b, true +} + +// String method converts the other direction, returning a string of +// '+', '-', and '0' characters representing the number. +func (b bt) String() string { + if len(b) == 0 { + return "0" + } + last := len(b) - 1 + r := make([]byte, len(b)) + for i, d := range b { + r[last-i] = "-0+"[d+1] + } + return string(r) +} + +// R3: integer conversion +// int chosen as "native integer" + +// btInt is a constructor like btString. +func btInt(i int) *bt { + if i == 0 { + return new(bt) + } + var b bt + var btDigit func(int) + btDigit = func(digit int) { + m := int8(i % 3) + i /= 3 + switch m { + case 2: + m = -1 + i++ + case -2: + m = 1 + i-- + } + if i == 0 { + b = make(bt, digit+1) + } else { + btDigit(digit + 1) + } + b[digit] = m + } + btDigit(0) + return &b +} + +// Int method converts the other way, returning the value as an int type. +// !ok means overflow occurred during conversion, not necessarily that the +// value is not representable as an int. (Of course there are other ways +// of doing it but this was chosen as "reasonable.") +func (b bt) Int() (r int, ok bool) { + pt := 1 + for _, d := range b { + dp := int(d) * pt + neg := r < 0 + r += dp + if neg { + if r > dp { + return 0, false + } + } else { + if r < dp { + return 0, false + } + } + pt *= 3 + } + return r, true +} + +// R4: negation, addition, and multiplication + +func (z *bt) Neg(b *bt) *bt { + if z != b { + if cap(*z) < len(*b) { + *z = make(bt, len(*b)) + } else { + *z = (*z)[:len(*b)] + } + } + for i, d := range *b { + (*z)[i] = -d + } + return z +} + +func (z *bt) Add(a, b *bt) *bt { + if len(*a) < len(*b) { + a, b = b, a + } + r := *z + r = r[:cap(r)] + var carry int8 + for i, da := range *a { + if i == len(r) { + n := make(bt, len(*a)+4) + copy(n, r) + r = n + } + sum := da + carry + if i < len(*b) { + sum += (*b)[i] + } + carry = sum / 3 + sum %= 3 + switch { + case sum > 1: + sum -= 3 + carry++ + case sum < -1: + sum += 3 + carry-- + } + r[i] = sum + } + last := len(*a) + if carry != 0 { + if len(r) == last { + n := make(bt, last+4) + copy(n, r) + r = n + } + r[last] = carry + *z = r[:last+1] + return z + } + for { + if last == 0 { + *z = nil + break + } + last-- + if r[last] != 0 { + *z = r[:last+1] + break + } + } + return z +} + +func (z *bt) Mul(a, b *bt) *bt { + if len(*a) < len(*b) { + a, b = b, a + } + var na bt + for _, d := range *b { + if d == -1 { + na.Neg(a) + break + } + } + r := make(bt, len(*a)+len(*b)) + for i := len(*b) - 1; i >= 0; i-- { + switch (*b)[i] { + case 1: + p := r[i:] + p.Add(&p, a) + case -1: + p := r[i:] + p.Add(&p, &na) + } + } + i := len(r) + for i > 0 && r[i-1] == 0 { + i-- + } + *z = r[:i] + return z +} + +func main() { + a, _ := btString("+-0++0+") + b := btInt(-436) + c, _ := btString("+-++-") + show("a:", a) + show("b:", b) + show("c:", c) + show("a(b-c):", a.Mul(a, b.Add(b, c.Neg(c)))) +} + +func show(label string, b *bt) { + fmt.Printf("%7s %12v ", label, b) + if i, ok := b.Int(); ok { + fmt.Printf("%7d\n", i) + } else { + fmt.Println("int overflow") + } +} diff --git a/Task/Balanced_ternary/Haskell/balanced_ternary.hs b/Task/Balanced_ternary/Haskell/balanced_ternary.hs new file mode 100644 index 0000000000..da40860af6 --- /dev/null +++ b/Task/Balanced_ternary/Haskell/balanced_ternary.hs @@ -0,0 +1,62 @@ +data BalancedTernary = Bt [Int] + +zeroTrim a = if null s then [0] else s where + s = f [] [] a + f x _ [] = x + f x y (0:zs) = f x (y++[0]) zs + f x y (z:zs) = f (x++y++[z]) [] zs + +btList (Bt a) = a + +instance Eq BalancedTernary where + (==) a b = btList a == btList b + +btNormalize = listBt . _carry 0 where + _carry c [] = if c == 0 then [] else [c] + _carry c (a:as) = r:_carry cc as where + (cc, r) = f $ (a+c) `quotRem` 3 where + f (x, 2) = (x + 1, -1) + f (x, -2) = (x - 1, 1) + f x = x + +listBt = Bt . zeroTrim + +instance Show BalancedTernary where + show = reverse . map (\d->case d of -1->'-'; 0->'0'; 1->'+') . btList + +strBt = Bt . zeroTrim.reverse.map (\c -> case c of '-' -> -1; '0' -> 0; '+' -> 1) + +intBt :: Integral a => a -> BalancedTernary +intBt = fromIntegral . toInteger + +btInt = f . btList where + f [] = 0 + f (a:as) = a + 3 * f as + +listAdd a b = take (max (length a) (length b)) $ zipWith (+) (a++[0,0..]) (b++[0,0..]) + +-- mostly for operators, also small stuff to make GHC happy +instance Num BalancedTernary where + negate = Bt . map negate . btList + (+) x y = btNormalize $ listAdd (btList x) (btList y) + (*) x y = btNormalize $ mul_ (btList x) (btList y) where + mul_ _ [] = [] + mul_ [] _ = [] + mul_ (a:as) b = listAdd (map (a*) b) (0:mul_ as b) where + + -- we don't need to define binary "-" by hand + + signum (Bt a) = if a == [0] then 0 else Bt [last a] + abs x = if signum x == Bt [-1] then negate x else x + + fromInteger = btNormalize . f where + f 0 = [] + f x = fromInteger (rem x 3) : f (quot x 3) + + +main = let (a,b,c) = (strBt "+-0++0+", intBt (-436), strBt "+-++-") + r = a * (b - c) + in do + print $ map btInt [a,b,c] + print $ r + print $ btInt r diff --git a/Task/Balanced_ternary/Prolog/balanced_ternary-2.pro b/Task/Balanced_ternary/Prolog/balanced_ternary-2.pro new file mode 100644 index 0000000000..087ad709dd --- /dev/null +++ b/Task/Balanced_ternary/Prolog/balanced_ternary-2.pro @@ -0,0 +1,123 @@ +:- module('bt_add.pl', [bt_add/3, + bt_add1/3, + op(900, xfx, btplus), + op(900, xfx, btmoins), + btplus/2, + btmoins/2, + strip_nombre/3 + ]). + +:- op(900, xfx, btplus). +:- op(900, xfx, btmoins). + +% define operator btplus +A is X btplus Y :- + bt_add(X, Y, A). + +% define operator btmoins +% no need to define a predicate for the substraction +A is X btmoins Y :- + X is Y btplus A. + + +% bt_add(?X, ?Y, ?R) +% R is X + Y +% X, Y, R are strings +% At least 2 args must be instantiated +bt_add(X, Y, R) :- + ( nonvar(X) -> string_to_list(X, X1); true), + ( nonvar(Y) -> string_to_list(Y, Y1); true), + ( nonvar(R) -> string_to_list(R, R1); true), + bt_add1(X1, Y1, R1), + ( var(X) -> string_to_list(X, X1); true), + ( var(Y) -> string_to_list(Y, Y1); true), + ( var(R) -> string_to_list(R, R1); true). + + + +% bt_add1(?X, ?Y, ?R) +% R is X + Y +% X, Y, R are lists +bt_add1(X, Y, R) :- + % initialisation : X and Y must have the same length + % we add zeros at the beginning of the shortest list + ( nonvar(X) -> length(X, LX); length(R, LR)), + ( nonvar(Y) -> length(Y, LY); length(R, LR)), + ( var(X) -> LX is max(LY, LR) , length(X1, LX), Y1 = Y ; X1 = X), + ( var(Y) -> LY is max(LX, LR) , length(Y1, LY), X1 = X ; Y1 = Y), + + Delta is abs(LX - LY), + ( LX < LY -> normalise(Delta, X1, X2), Y1 = Y2 + ; LY < LX -> normalise(Delta, Y1, Y2), X1 = X2 + ; X1 = X2, Y1 = Y2), + + + % if R is instancied, it must have, at least, the same length than X or Y + Max is max(LX, LY), + ( (nonvar(R), length(R, LR), LR < Max) -> Delta1 is Max - LR, normalise(Delta1, R, R2) + ; nonvar(R) -> R = R2 + ; true), + + bt_add(X2, Y2, C, R2), + + ( C = 48 -> strip_nombre(R2, R, []), + ( var(X) -> strip_nombre(X2, X, []) ; true), + ( var(Y) -> strip_nombre(Y2, Y, []) ; true) + ; var(R) -> strip_nombre([C|R2], R, []) + ; ( select(C, [45,43], [Ca]), + ( var(X) -> strip_nombre([Ca | X2], X, []) + ; strip_nombre([Ca | Y2], Y, [])))). + + +% here we actually compute the sum +bt_add([], [], 48, []). + +bt_add([H1|T1], [H2|T2], C3, [R2 | L]) :- + bt_add(T1, T2, C, L), + % add HH1 and H2 + ternary_sum(H1, H2, R1, C1), + % add first carry, + ternary_sum(R1, C, R2, C2), + % add second carry + ternary_sum(C1, C2, C3, _). + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ternary_sum +% @arg1 : V1 +% @arg2 : V2 +% @arg3 : R is V1 + V2 +% @arg4 : Carry +ternary_sum(43, 43, 45, 43). + +ternary_sum(43, 45, 48, 48). + +ternary_sum(45, 43, 48, 48). + +ternary_sum(45, 45, 43, 45). + +ternary_sum(X, 48, X, 48). + +ternary_sum(48, X, X, 48). + + +% if L has a length smaller than N, complete L with 0 (code 48) +normalise(0, L, L) :- !. +normalise(N, L1, L) :- + N1 is N - 1, + normalise(N1, [48 | L1], L). + + +% contrary of normalise +% remove leading zeros. +% special case of number 0 ! +strip_nombre([48]) --> {!}, "0". + +% enlève les zéros inutiles +strip_nombre([48 | L]) --> + strip_nombre(L). + + +strip_nombre(L) --> + L. diff --git a/Task/Balanced_ternary/Prolog/balanced_ternary-3.pro b/Task/Balanced_ternary/Prolog/balanced_ternary-3.pro new file mode 100644 index 0000000000..c76b448425 --- /dev/null +++ b/Task/Balanced_ternary/Prolog/balanced_ternary-3.pro @@ -0,0 +1,170 @@ +:- module('bt_mult.pl', [op(850, xfx, btmult), + btmult/2, + multiplication/3 + ]). + +:- use_module('bt_add.pl'). + +:- op(850, xfx, btmult). +A is B btmult C :- + multiplication(B, C, A). + +neg(A, B) :- + maplist(opp, A, B). + +opp(48, 48). +opp(45, 43). +opp(43, 45). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the multiplication (efficient) +% multiplication(+BIn, +QIn, -AOut) +% Aout is BIn * QIn +% BIn, QIn, AOut are strings +multiplication(BIn, QIn, AOut) :- + string_to_list(BIn, B), + string_to_list(QIn, Q), + + % We work with positive numbers + ( B = [45 | _] -> Pos0 = false, neg(B,BP) ; BP = B, Pos0 = true), + ( Q = [45 | _] -> neg(Q, QP), select(Pos0, [true, false], [Pos1]); QP = Q, Pos1 = Pos0), + + multiplication_(BP, QP, [48], A), + ( Pos1 = false -> neg(A, A1); A1 = A), + string_to_list(AOut, A1). + + +multiplication_(_B, [], A, A). + +multiplication_(B, [H | T], A, AF) :- + multiplication_1(B, H, B1), + append(A, [48], A1), + bt_add1(B1, A1, A2), + multiplication_(B, T, A2, AF). + +% by 1 (digit '+' code 43) +multiplication_1(B, 43, B). + +% by 0 (digit '0' code 48) +multiplication_1(_, 48, [48]). + +% by -1 (digit '-' code 45) +multiplication_1(B, 45, B1) :- neg(B, B1). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the division (efficient) +% division(+AIn, +BIn, -QOut, -ROut) +% +division(AIn, BIn, QOut, ROut) :- + string_to_list(AIn, A), + string_to_list(BIn, B), + length(B, LB), + length(A, LA), + Len is LA - LB, + ( Len < 0 -> Q = [48], R = A + ; neg(B, NegB), division_(A, B, NegB, LB, Len, [], Q, R)), + string_to_list(QOut, Q), + string_to_list(ROut, R). + + +division_(A, B, NegB, LenB, LenA, QC, QF, R) :- + % if the remainder R is negative (last number A), we must decrease the quotient Q, annd add B to R + ( LenA = -1 -> (A = [45 | _] -> positive(A, B, QC, QF, R) ; QF = QC, A = R) + ; extract(LenA, _, A, AR, AF), + length(AR, LR), + + ( LR >= LenB -> ( AR = [43 | _] -> + bt_add1(AR, NegB, S), Q0 = [43], + % special case : R has the same length than B + % and his first digit is + (1) + % we must do another one substraction + ( (length(S, LenB), S = [43|_]) -> + bt_add1(S, NegB, S1), + bt_add1(QC, [43], QC1), + Q00 = [45] + ; S1 = S, QC1 = QC, Q00 = Q0) + + + ; bt_add1(AR, B, S1), Q00 = [45], QC1 = QC), + append(QC1, Q00, Q1), + append(S1, AF, A1), + strip_nombre(A1, A2, []), + LenA1 is LenA - 1, + division_(A2, B, NegB, LenB, LenA1, Q1, QF, R) + + ; append(QC, [48], Q1), LenA1 is LenA - 1, + division_(A, B, NegB, LenB, LenA1, Q1, QF, R))). + +% extract(+Len, ?N1, +L, -Head, -Tail) +% remove last N digits from the list L +% put them in Tail. +extract(Len, Len, [], [], []). + +extract(Len, N1, [H|T], AR1, AF1) :- + extract(Len, N, T, AR, AF), + N1 is N-1, + ( N > 0 -> AR = AR1, AF1 = [H | AF]; AR1 = [H | AR], AF1 = AF). + + + +positive(R, _, Q, Q, R) :- R = [43 | _]. + +positive(S, B, Q, QF, R ) :- + bt_add1(S, B, S1), + bt_add1(Q, [45], Q1), + positive(S1, B, Q1, QF, R). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% "euclidian" division (inefficient) +% euclide(?A, +BIn, ?Q, ?R) +% A = B * Q + R +euclide(A, B, Q, R) :- + mult(A, B, Q, R). + + +mult(AIn, BIn, QIn, RIn) :- + ( nonvar(AIn) -> string_to_list(AIn, A); A = AIn), + ( nonvar(BIn) -> string_to_list(BIn, B); B = BIn), + ( nonvar(QIn) -> string_to_list(QIn, Q); Q = QIn), + ( nonvar(RIn) -> string_to_list(RIn, R); R = RIn), + + % we use positive numbers + ( B = [45 | _] -> Pos0 = false, neg(B,BP) ; BP = B, Pos0 = true), + ( (nonvar(Q), Q = [45 | _]) -> neg(Q, QP), select(Pos0, [true, false], [Pos1]) + ; nonvar(Q) -> Q = QP , Pos1 = Pos0 + ; Pos1 = Pos0), + ( (nonvar(A), A = [45 | _]) -> neg(A, AP) + ; nonvar(A) -> AP = A + ; true), + + % is R instancied ? + ( nonvar(R) -> R1 = R; true), + % multiplication ? we add B to A and substract 1 (digit '-') to Q + ( nonvar(Q) -> BC = BP, Ajout = [45], + ( nonvar(R) -> bt_add1(BC, R, AP) ; AP = BC) + % division ? we substract B to A and add 1 (digit '+') to Q + ; neg(BP, BC), Ajout = [43], QP = [48]), + + % do the real job + mult_(BC, QP, AP, R1, Resultat, Ajout), + + ( var(QIn) -> (Pos1 = false -> neg(Resultat, QT); Resultat = QT), string_to_list(QIn, QT) + ; true), + ( var(AIn) -> (Pos1 = false -> neg(Resultat, AT); Resultat = AT), string_to_list(AIn, AT) + ; true), + ( var(RIn) -> string_to_list(RIn, R1); true). + +% @arg1 : divisor +% @arg2 : quotient +% @arg3 : dividend +% @arg4 : remainder +% @arg5 : Result : receive either the dividend A +% either the quotient Q +mult_(B, Q, A, R, Resultat, Ajout) :- + bt_add1(Q, Ajout, Q1), + bt_add1(A, B, A1), + ( Q1 = [48] -> Resultat = A % a multiplication + ; ( A1 = [45 | _], Ajout = [43]) -> Resultat = Q, R = A % a division + ; mult_(B, Q1, A1, R, Resultat, Ajout)) . diff --git a/Task/Balanced_ternary/Prolog/balanced_ternary.pro b/Task/Balanced_ternary/Prolog/balanced_ternary.pro new file mode 100644 index 0000000000..abb9250eba --- /dev/null +++ b/Task/Balanced_ternary/Prolog/balanced_ternary.pro @@ -0,0 +1,67 @@ +:- module('bt_convert.pl', [bt_convert/2, + op(950, xfx, btconv), + btconv/2]). + +:- use_module(library(clpfd)). + +:- op(950, xfx, btconv). + +X btconv Y :- + bt_convert(X, Y). + +% bt_convert(?X, ?L) +bt_convert(X, L) :- + ( (nonvar(L), \+is_list(L)) ->string_to_list(L, L1); L1 = L), + convert(X, L1), + ( var(L) -> string_to_list(L, L1); true). + +% map numbers toward digits +, - 0 +plus_moins( 1, 43). +plus_moins(-1, 45). +plus_moins( 0, 48). + + +convert(X, [48| L]) :- + var(X), + ( L \= [] -> convert(X, L); X = 0, !). + +convert(0, L) :- + var(L), !, string_to_list(L, [48]). + +convert(X, L) :- + ( (nonvar(X), X > 0) + ; (var(X), X #> 0, + L = [43|_], + maplist(plus_moins, L1, L))), + !, + convert(X, 0, [], L1), + ( nonvar(X) -> maplist(plus_moins, L1, LL), string_to_list(L, LL) + ; true). + +convert(X, L) :- + ( nonvar(X) -> Y is -X + ; X #< 0, + maplist(plus_moins, L2, L), + maplist(mult(-1), L2, L1)), + convert(Y, 0, [], L1), + ( nonvar(X) -> + maplist(mult(-1), L1, L2), + maplist(plus_moins, L2, LL), + string_to_list(L, LL) + ; X #= -Y). + +mult(X, Y, Z) :- + Z #= X * Y. + + +convert(0, 0, L, L) :- !. + +convert(0, 1, L, [1 | L]) :- !. + + +convert(N, C, LC, LF) :- + R #= N mod 3 + C, + R #> 1 #<==> C1, + N1 #= N / 3, + R1 #= R - 3 * C1, % C1 #= 1, + convert(N1, C1, [R1 | LC], LF). diff --git a/Task/Balanced_ternary/Python/balanced_ternary.py b/Task/Balanced_ternary/Python/balanced_ternary.py new file mode 100644 index 0000000000..dd659856fd --- /dev/null +++ b/Task/Balanced_ternary/Python/balanced_ternary.py @@ -0,0 +1,95 @@ +class BalancedTernary: + # Represented as a list of 0, 1 or -1s, with least significant digit first. + + str2dig = {'+': 1, '-': -1, '0': 0} # immutable + dig2str = {1: '+', -1: '-', 0: '0'} # immutable + table = ((0, -1), (1, -1), (-1, 0), (0, 0), (1, 0), (-1, 1), (0, 1)) # immutable + + def __init__(self, inp): + if isinstance(inp, str): + self.digits = [BalancedTernary.str2dig[c] for c in reversed(inp)] + elif isinstance(inp, int): + self.digits = self._int2ternary(inp) + elif isinstance(inp, BalancedTernary): + self.digits = list(inp.digits) + elif isinstance(inp, list): + if all(d in (0, 1, -1) for d in inp): + self.digits = list(inp) + else: + raise ValueError("BalancedTernary: Wrong input digits.") + else: + raise TypeError("BalancedTernary: Wrong constructor input.") + + @staticmethod + def _int2ternary(n): + if n == 0: return [] + if (n % 3) == 0: return [0] + BalancedTernary._int2ternary(n // 3) + if (n % 3) == 1: return [1] + BalancedTernary._int2ternary(n // 3) + if (n % 3) == 2: return [-1] + BalancedTernary._int2ternary((n + 1) // 3) + + def to_int(self): + return reduce(lambda y,x: x + 3 * y, reversed(self.digits), 0) + + def __repr__(self): + if not self.digits: return "0" + return "".join(BalancedTernary.dig2str[d] for d in reversed(self.digits)) + + @staticmethod + def _neg(digs): + return [-d for d in digs] + + def __neg__(self): + return BalancedTernary(BalancedTernary._neg(self.digits)) + + @staticmethod + def _add(a, b, c=0): + if not (a and b): + if c == 0: + return a or b + else: + return BalancedTernary._add([c], a or b) + else: + (d, c) = BalancedTernary.table[3 + (a[0] if a else 0) + (b[0] if b else 0) + c] + res = BalancedTernary._add(a[1:], b[1:], c) + # trim leading zeros + if res or d != 0: + return [d] + res + else: + return res + + def __add__(self, b): + return BalancedTernary(BalancedTernary._add(self.digits, b.digits)) + + def __sub__(self, b): + return self + (-b) + + @staticmethod + def _mul(a, b): + if not (a and b): + return [] + else: + if a[0] == -1: x = BalancedTernary._neg(b) + elif a[0] == 0: x = [] + elif a[0] == 1: x = b + else: assert False + y = [0] + BalancedTernary._mul(a[1:], b) + return BalancedTernary._add(x, y) + + def __mul__(self, b): + return BalancedTernary(BalancedTernary._mul(self.digits, b.digits)) + + +def main(): + a = BalancedTernary("+-0++0+") + print "a:", a.to_int(), a + + b = BalancedTernary(-436) + print "b:", b.to_int(), b + + c = BalancedTernary("+-++-") + print "c:", c.to_int(), c + + r = a * (b - c) + print "a * (b - c):", r.to_int(), r + +main() diff --git a/Task/Balanced_ternary/REXX/balanced_ternary.rexx b/Task/Balanced_ternary/REXX/balanced_ternary.rexx new file mode 100644 index 0000000000..72522526a0 --- /dev/null +++ b/Task/Balanced_ternary/REXX/balanced_ternary.rexx @@ -0,0 +1,55 @@ +/*REXX pgm converts decimal ◄───► balanced ternary; also performs arith.*/ +numeric digits 10000 /*handle almost any size numbers.*/ +Ao = '+-0++0+' ; Abt = Ao /* [↓] 2 literals used by sub.*/ +Bo = '-436' ; Bbt = d2bt(Bo) ; @ = '(decimal)' +Co = '+-++-' ; Cbt = Co ; @@ = 'balanced ternary =' + call btShow '[a]', Abt + call btShow '[b]', Bbt + call btShow '[c]', Cbt + say; $bt = btMul(Abt,btSub(Bbt,Cbt)) + call btshow '[a*(b-c)]', $bt +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────BT2D subroutine─────────────────────*/ +d2bt: procedure; parse arg x 1; p=0; $.='-'; $.1='+'; $.0=0; #= +x=x/1 + do until x==0; _=(x//(3**(p+1)))%3**p + if _==2 then _=-1; if _=-2 then _=1 + x=x-_*(3**p); p=p+1; #=$._ || # + end /*until*/ +return # +/*──────────────────────────────────BT2D subroutine─────────────────────*/ +bt2d: procedure; parse arg x; r=reverse(x); #=0; $.=-1; $.0=0; _='+'; $._=1 + do j=1 for length(x); _=substr(r,j,1); #=#+$._*3**(j-1); end +return # +/*──────────────────────────────────BTADD subroutine────────────────────*/ +btAdd: procedure; parse arg x,y; rx=reverse(x); ry=reverse(y); carry=0 +$.='-'; $.0=0; $.1='+'; @.=0; _='-'; @._=-1; _="+"; @._=1; #= + + do j=1 for max(length(x),length(y)) + x_=substr(rx,j,1); xn=@.x_ + y_=substr(ry,j,1); yn=@.y_ + s=xn+yn+carry ; carry=0 + if s== 2 then do; s=-1; carry= 1; end + if s== 3 then do; s= 0; carry= 1; end + if s==-2 then do; s= 1; carry=-1; end + #=$.s || # + end /*j*/ +if carry\==0 then #=$.carry || #; return btNorm(#) +/*──────────────────────────────────BTMUL subroutine────────────────────*/ +btMul: procedure; parse arg x,y; if x==0 | y==0 then return 0; S=1 +x=btNorm(x); y=btNorm(y) /*handle: 0-xxx values.*/ +if left(x,1)=='-' then do; x=btNeg(x); S=-S; end /*positate.*/ +if left(y,1)=='-' then do; y=btNeg(y); S=-S; end /*positate.*/ +if length(y)>length(x) then parse value x y with y x /*optimize.*/ +P=0 + do until y==0 /*keep adding 'til done*/ + P=btAdd(P,x) /*multiple the hard way*/ + y=btSub(y,'+') /*subtract 1 from Y. */ + end /*until*/ +if S==-1 then P=btNeg(P) /*adjust product sign. */ +return P /*return the product P.*/ +/*───────────────────────────────one-line subroutines───────────────────*/ +btNeg: return translate(arg(1), '-+', "+-") /*negate the bal_tern #*/ +btNorm: _=strip(arg(1),'L',0); if _=='' then _=0; return _ /*normalize*/ +btSub: return btAdd(arg(1), btNeg(arg(2))) /*subtract two BT args.*/ +btShow: say center(arg(1),9) right(arg(2),20) @@ right(bt2d(arg(2)),9) @; return diff --git a/Task/Balanced_ternary/Ruby/balanced_ternary.rb b/Task/Balanced_ternary/Ruby/balanced_ternary.rb new file mode 100644 index 0000000000..1eec10bd32 --- /dev/null +++ b/Task/Balanced_ternary/Ruby/balanced_ternary.rb @@ -0,0 +1,128 @@ +class BalancedTernary + def initialize(str = "") + if str !~ /^[-+0]+$/ + raise ArgumentError, "invalid BalancedTernary number: #{str}" + end + @digits = trim0(str) + end + + def self.from_int(value) + n = value + digits = "" + while n != 0 + quo, rem = n.divmod(3) + case rem + when 0 + digits = "0" + digits + n = quo + when 1 + digits = "+" + digits + n = quo + when 2 + digits = "-" + digits + n = quo + 1 + end + end + new(digits) + end + + def to_int + @digits.chars.inject(0) do |sum, char| + sum *= 3 + case char + when "+" + sum += 1 + when "-" + sum -= 1 + end + sum + end + end + alias :to_i :to_int + + def to_s + @digits + end + alias :inspect :to_s + + ADDITION_TABLE = { + "-" => {"-" => ["-","+"], "0" => ["0","-"], "+" => ["0","0"]}, + "0" => {"-" => ["0","-"], "0" => ["0","0"], "+" => ["0","+"]}, + "+" => {"-" => ["0","0"], "0" => ["0","+"], "+" => ["+","-"]}, + } + + def +(other) + maxl = [to_s, other.to_s].collect {|s| s.length}.max + a = pad0(to_s, maxl) + b = pad0(other.to_s, maxl) + carry = "0" + sum = a.reverse.chars.zip( b.reverse.chars ).inject("") do |sum, (c1, c2)| + carry1, digit1 = ADDITION_TABLE[c1][c2] + carry2, digit2 = ADDITION_TABLE[carry][digit1] + sum = digit2 + sum + carry = ADDITION_TABLE[carry1][carry2][1] + sum + end + self.class.new(carry + sum) + end + + MULTIPLICATION_TABLE = { + "-" => "+0-", + "0" => "000", + "+" => "-0+", + } + + def *(other) + product = self.class.new("0") + other.to_s.each_char do |bdigit| + row = to_s.tr("-0+", MULTIPLICATION_TABLE[bdigit]) + product += self.class.new(row) + product << 1 + end + product >> 1 + end + + # negation + def -@() + self * BalancedTernary.new("-") + end + + # subtraction + def -(other) + self + (-other) + end + + # shift left + def <<(count) + @digits = trim0(@digits + "0"*count) + self + end + + # shift right + def >>(count) + @digits[-count..-1] = "" if count > 0 + @digits = trim0(@digits) + self + end + + private + + def trim0(str) + str = str.sub(/^0+/, "") + str = "0" if str.empty? + str + end + + def pad0(str, len) + str.rjust(len, "0") + end +end + +a = BalancedTernary.new("+-0++0+") +b = BalancedTernary.from_int(-436) +c = BalancedTernary.new("+-++-") +calc = a * (b - c) +puts "%s\t%d\t%s\n" % ['a', a.to_i, a] +puts "%s\t%d\t%s\n" % ['b', b.to_i, b] +puts "%s\t%d\t%s\n" % ['c', c.to_i, c] +puts "%s\t%d\t%s\n" % ['a*(b-c)', calc.to_i, calc] diff --git a/Task/Balanced_ternary/Tcl/balanced_ternary-2.tcl b/Task/Balanced_ternary/Tcl/balanced_ternary-2.tcl new file mode 100644 index 0000000000..6a16fc337e --- /dev/null +++ b/Task/Balanced_ternary/Tcl/balanced_ternary-2.tcl @@ -0,0 +1,10 @@ +for {set i 0} {$i<=10} {incr i} {puts "$i = [int-bt $i]"} +puts "'+-+'+'+--' = [bt-add +-+ +--] = [bt-int [bt-add +-+ +--]]" +puts "'++'*'++' = [bt-mul ++ ++] = [bt-int [bt-mul ++ ++]]" + +set a "+-0++0+" +set b [int-bt -436] +set c "+-++-" +puts "a = [bt-int $a], b = [bt-int $b], c = [bt-int $c]" +set abc [bt-mul $a [bt-sub $b $c]] +puts "a*(b-c) = $abc (== [bt-int $abc])" diff --git a/Task/Balanced_ternary/Tcl/balanced_ternary.tcl b/Task/Balanced_ternary/Tcl/balanced_ternary.tcl new file mode 100644 index 0000000000..9598aca056 --- /dev/null +++ b/Task/Balanced_ternary/Tcl/balanced_ternary.tcl @@ -0,0 +1,57 @@ +package require Tcl 8.5 + +proc bt-int b { + set n 0 + foreach c [split $b ""] { + set n [expr {$n * 3}] + switch -- $c { + + { incr n 1 } + - { incr n -1 } + } + } + return $n +} +proc int-bt n { + if {$n == 0} { + return "0" + } + while {$n != 0} { + lappend result [lindex {0 + -} [expr {$n % 3}]] + set n [expr {$n / 3 + ($n%3 == 2)}] + } + return [join [lreverse $result] ""] +} + +proc bt-neg b { + string map {+ - - +} $b +} +proc bt-sub {a b} { + bt-add $a [bt-neg $b] +} +proc bt-add-digits {a b c} { + if {$a eq ""} {set a 0} + if {$b eq ""} {set b 0} + if {$a ne 0} {append a 1} + if {$b ne 0} {append b 1} + lindex {{0 -1} {+ -1} {- 0} {0 0} {+ 0} {- 1} {0 1}} [expr {$a+$b+$c+3}] +} +proc bt-add {a b} { + set c 0 + set result {} + foreach ca [lreverse [split $a ""]] cb [lreverse [split $b ""]] { + lassign [bt-add-digits $ca $cb $c] d c + lappend result $d + } + if {$c ne "0"} {lappend result [lindex {0 + -} $c]} + if {![llength $result]} {return "0"} + string trimleft [join [lreverse $result] ""] 0 +} +proc bt-mul {a b} { + if {$a eq "0" || $a eq "" || $b eq "0"} {return "0"} + set sub [bt-mul [string range $a 0 end-1] $b]0 + switch -- [string index $a end] { + 0 { return $sub } + + { return [bt-add $sub $b] } + - { return [bt-sub $sub $b] } + } +} diff --git a/Task/Best_shuffle/0DESCRIPTION b/Task/Best_shuffle/0DESCRIPTION new file mode 100644 index 0000000000..0b0eb5b4ad --- /dev/null +++ b/Task/Best_shuffle/0DESCRIPTION @@ -0,0 +1,11 @@ +Shuffle the characters of a string in such a way that as many of the character values are in a different position as possible. Print the result as follows: original string, shuffled string, (score). The score gives the number of positions whose character value did ''not'' change. + +For example: tree, eetr, (0) + +A shuffle that produces a randomized result among the best choices is to be preferred. A deterministic approach that produces the same sequence every time is acceptable as an alternative. + +The words to test with are: abracadabra, seesaw, elk, grrrrrr, up, a + +;Cf. +* [[Anagrams/Deranged anagrams]] +* [[Permutations/Derangements]] diff --git a/Task/Best_shuffle/AWK/best_shuffle-2.awk b/Task/Best_shuffle/AWK/best_shuffle-2.awk new file mode 100644 index 0000000000..e3c0ed677e --- /dev/null +++ b/Task/Best_shuffle/AWK/best_shuffle-2.awk @@ -0,0 +1,79 @@ +# out["string"] = best shuffle of string _s_ +# out["score"] = number of matching characters +function best_shuffle(out, s, c, i, j, k, klen, p, pos, set, rlen, slen) { + slen = length(s) + for (i = 1; i <= slen; i++) { + c = substr(s, i, 1) + + # _set_ of all characters in _s_, with count + set[c] += 1 + + # _pos_ classifies positions by letter, + # such that pos[c, 1], pos[c, 2], ..., pos[c, set[c]] + # are the positions of _c_ in _s_. + pos[c, set[c]] = i + } + + # k[1], k[2], ..., k[klen] sorts letters from low to high count + klen = 0 + for (c in set) { + # insert _c_ into _k_ + i = 1 + while (i <= klen && set[k[i]] <= set[c]) + i++ # find _i_ to sort by insertion + for (j = klen; j >= i; j--) + k[j + 1] = k[j] # make room for k[i] + k[i] = c + klen++ + } + + # Fill pos[slen], ..., pos[3], pos[2], pos[1] with positions + # in the order that we want to fill them. + i = 1 + while (i <= slen) { + for (j = 1; j <= klen; j++) { + c = k[j] + if (set[c] > 0) { + pos[i] = pos[c, set[c]] + i++ + delete pos[c, set[c]] + set[c]-- + } + } + } + + # Now fill in _new_ with _letters_ according to each position + # in pos[slen], ..., pos[1], but skip ahead in _letters_ + # if we can avoid matching characters that way. + rlen = split(s, letters, "") + for (i = slen; i >= 1; i--) { + j = 1 + p = pos[i] + while (letters[j] == substr(s, p, 1) && j < rlen) + j++ + for (new[p] = letters[j]; j < rlen; j++) + letters[j] = letters[j + 1] + delete letters[rlen] + rlen-- + } + + out["string"] = "" + for (i = 1; i <= slen; i++) { + out["string"] = out["string"] new[i] + } + + out["score"] = 0 + for (i = 1; i <= slen; i++) { + if (new[i] == substr(s, i, 1)) + out["score"]++ + } +} + +BEGIN { + count = split("abracadabra seesaw elk grrrrrr up a", words) + for (i = 1; i <= count; i++) { + best_shuffle(result, words[i]) + printf "%s, %s, (%d)\n", + words[i], result["string"], result["score"] + } +} diff --git a/Task/Best_shuffle/AWK/best_shuffle-3.awk b/Task/Best_shuffle/AWK/best_shuffle-3.awk new file mode 100644 index 0000000000..8f7f2ee690 --- /dev/null +++ b/Task/Best_shuffle/AWK/best_shuffle-3.awk @@ -0,0 +1,7 @@ +$ awk -f best-shuffle.awk +abracadabra, baarrcadaab, (0) +seesaw, essewa, (0) +elk, kel, (0) +grrrrrr, rgrrrrr, (5) +up, pu, (0) +a, a, (1) diff --git a/Task/Best_shuffle/AWK/best_shuffle.awk b/Task/Best_shuffle/AWK/best_shuffle.awk new file mode 100644 index 0000000000..31cec9f821 --- /dev/null +++ b/Task/Best_shuffle/AWK/best_shuffle.awk @@ -0,0 +1,40 @@ +{ + scram = best_shuffle($0) + print $0 " -> " scram " (" unchanged($0, scram) ")" +} + +function best_shuffle(s, c, i, j, len, r, t) { + len = split(s, t, "") + + # Swap elements of t[] to get a best shuffle. + for (i = 1; i <= len; i++) { + for (j = 1; j <= len; j++) { + # Swap t[i] and t[j] if they will not match + # the original characters from s. + if (i != j && + t[i] != substr(s, j, 1) && + substr(s, i, 1) != t[j]) { + c = t[i] + t[i] = t[j] + t[j] = c + break + } + } + } + + # Join t[] into one string. + r = "" + for (i = 1; i <= len; i++) + r = r t[i] + return r +} + +function unchanged(s1, s2, count, len) { + count = 0 + len = length(s1) + for (i = 1; i <= len; i++) { + if (substr(s1, i, 1) == substr(s2, i, 1)) + count++ + } + return count +} diff --git a/Task/Best_shuffle/C/best_shuffle-2.c b/Task/Best_shuffle/C/best_shuffle-2.c new file mode 100644 index 0000000000..d210eda6e9 --- /dev/null +++ b/Task/Best_shuffle/C/best_shuffle-2.c @@ -0,0 +1,106 @@ +#include +#include +#include + +typedef struct letter_group_t { + char c; + int count; +} *letter_p; + +struct letter_group_t all_letters[26]; +letter_p letters[26]; + +/* counts how many of each letter is in a string, used later + * to generate permutations + */ +int count_letters(const char *s) +{ + int i, c; + for (i = 0; i < 26; i++) { + all_letters[i].count = 0; + all_letters[i].c = i + 'a'; + } + while (*s != '\0') { + i = *(s++); + + /* don't want to deal with bad inputs */ + if (i < 'a' || i > 'z') { + fprintf(stderr, "Abort: Bad string %s\n", s); + exit(1); + } + + all_letters[i - 'a'].count++; + } + for (i = 0, c = 0; i < 26; i++) + if (all_letters[i].count) + letters[c++] = all_letters + i; + + return c; +} + +int least_overlap, seq_no; +char out[100], orig[100], best[100]; + +void permutate(int n_letters, int pos, int overlap) +{ + int i, ol; + if (pos < 0) { + /* if enabled will show all shuffles no worse than current best */ + // printf("%s: %d\n", out, overlap); + + /* if better than current best, replace it and reset counter */ + if (overlap < least_overlap) { + least_overlap = overlap; + seq_no = 0; + } + + /* the Nth best tie has 1/N chance of being kept, so all ties + * have equal chance of being selected even though we don't + * how many there are before hand + */ + if ( (double)rand() / (RAND_MAX + 1.0) * ++seq_no <= 1) + strcpy(best, out); + + return; + } + + /* standard "try take the letter; try take not" recursive method */ + for (i = 0; i < n_letters; i++) { + if (!letters[i]->count) continue; + + out[pos] = letters[i]->c; + letters[i]->count --; + ol = (letters[i]->c == orig[pos]) ? overlap + 1 : overlap; + + /* but don't try options that's already worse than current best */ + if (ol <= least_overlap) + permutate(n_letters, pos - 1, ol); + + letters[i]->count ++; + } + return; +} + +void do_string(const char *str) +{ + least_overlap = strlen(str); + strcpy(orig, str); + + seq_no = 0; + out[least_overlap] = '\0'; + least_overlap ++; + + permutate(count_letters(str), least_overlap - 2, 0); + printf("%s -> %s, overlap %d\n", str, best, least_overlap); +} + +int main() +{ + srand(time(0)); + do_string("abracadebra"); + do_string("grrrrrr"); + do_string("elk"); + do_string("seesaw"); + do_string(""); + return 0; +} diff --git a/Task/Best_shuffle/C/best_shuffle-3.c b/Task/Best_shuffle/C/best_shuffle-3.c new file mode 100644 index 0000000000..6d55537ed1 --- /dev/null +++ b/Task/Best_shuffle/C/best_shuffle-3.c @@ -0,0 +1,5 @@ +abracadebra -> edbcarabaar, overlap 0 +grrrrrr -> rrgrrrr, overlap 5 +elk -> kel, overlap 0 +seesaw -> ewsesa, overlap 0 + -> , overlap 0 diff --git a/Task/Best_shuffle/C/best_shuffle-4.c b/Task/Best_shuffle/C/best_shuffle-4.c new file mode 100644 index 0000000000..cb5107f18d --- /dev/null +++ b/Task/Best_shuffle/C/best_shuffle-4.c @@ -0,0 +1,36 @@ +#include +#include + +#define FOR(x, y) for(x = 0; x < y; x++) +char *best_shuffle(const char *s, int *diff) +{ + int i, j = 0, max = 0, l = strlen(s), cnt[128] = {0}; + char buf[256] = {0}, *r; + + FOR(i, l) if (++cnt[(int)s[i]] > max) max = cnt[(int)s[i]]; + FOR(i, 128) while (cnt[i]--) buf[j++] = i; + + r = strdup(s); + FOR(i, l) FOR(j, l) + if (r[i] == buf[j]) { + r[i] = buf[(j + max) % l] & ~128; + buf[j] |= 128; + break; + } + + *diff = 0; + FOR(i, l) *diff += r[i] == s[i]; + + return r; +} + +int main() +{ + int i, d; + const char *r, *t[] = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a", 0}; + for (i = 0; t[i]; i++) { + r = best_shuffle(t[i], &d); + printf("%s %s (%d)\n", t[i], r, d); + } + return 0; +} diff --git a/Task/Best_shuffle/C/best_shuffle.c b/Task/Best_shuffle/C/best_shuffle.c new file mode 100644 index 0000000000..b40ef8d06f --- /dev/null +++ b/Task/Best_shuffle/C/best_shuffle.c @@ -0,0 +1,111 @@ +#include +#include +#include +#include +#include + +#define DEBUG + +void best_shuffle(const char* txt, char* result) { + const size_t len = strlen(txt); + if (len == 0) + return; + +#ifdef DEBUG + // txt and result must have the same length + assert(len == strlen(result)); +#endif + + // how many of each character? + size_t counts[UCHAR_MAX]; + memset(counts, '\0', UCHAR_MAX * sizeof(int)); + size_t fmax = 0; + for (size_t i = 0; i < len; i++) { + counts[(unsigned char)txt[i]]++; + const size_t fnew = counts[(unsigned char)txt[i]]; + if (fmax < fnew) + fmax = fnew; + } + assert(fmax > 0 && fmax <= len); + + // all character positions, grouped by character + size_t *ndx1 = malloc(len * sizeof(size_t)); + if (ndx1 == NULL) + exit(EXIT_FAILURE); + for (size_t ch = 0, i = 0; ch < UCHAR_MAX; ch++) + if (counts[ch]) + for (size_t j = 0; j < len; j++) + if (ch == (unsigned char)txt[j]) { + ndx1[i] = j; + i++; + } + + // regroup them for cycles + size_t *ndx2 = malloc(len * sizeof(size_t)); + if (ndx2 == NULL) + exit(EXIT_FAILURE); + for (size_t i = 0, n = 0, m = 0; i < len; i++) { + ndx2[i] = ndx1[n]; + n += fmax; + if (n >= len) { + m++; + n = m; + } + } + + // how long can our cyclic groups be? + const size_t grp = 1 + (len - 1) / fmax; + assert(grp > 0 && grp <= len); + + // how many of them are full length? + const size_t lng = 1 + (len - 1) % fmax; + assert(lng > 0 && lng <= len); + + // rotate each group + for (size_t i = 0, j = 0; i < fmax; i++) { + const size_t first = ndx2[j]; + const size_t glen = grp - (i < lng ? 0 : 1); + for (size_t k = 1; k < glen; k++) + ndx1[j + k - 1] = ndx2[j + k]; + ndx1[j + glen - 1] = first; + j += glen; + } + + // result is original permuted according to our cyclic groups + result[len] = '\0'; + for (size_t i = 0; i < len; i++) + result[ndx2[i]] = txt[ndx1[i]]; + + free(ndx1); + free(ndx2); +} + +void display(const char* txt1, const char* txt2) { + const size_t len = strlen(txt1); + assert(len == strlen(txt2)); + int score = 0; + for (size_t i = 0; i < len; i++) + if (txt1[i] == txt2[i]) + score++; + (void)printf("%s, %s, (%u)\n", txt1, txt2, score); +} + +int main() { + const char* data[] = {"abracadabra", "seesaw", "elk", "grrrrrr", + "up", "a", "aabbbbaa", "", "xxxxx"}; + const size_t data_len = sizeof(data) / sizeof(data[0]); + for (size_t i = 0; i < data_len; i++) { + const size_t shuf_len = strlen(data[i]) + 1; + char shuf[shuf_len]; + +#ifdef DEBUG + memset(shuf, 0xFF, sizeof shuf); + shuf[shuf_len - 1] = '\0'; +#endif + + best_shuffle(data[i], shuf); + display(data[i], shuf); + } + + return EXIT_SUCCESS; +} diff --git a/Task/Best_shuffle/Clojure/best_shuffle.clj b/Task/Best_shuffle/Clojure/best_shuffle.clj new file mode 100644 index 0000000000..c482714f79 --- /dev/null +++ b/Task/Best_shuffle/Clojure/best_shuffle.clj @@ -0,0 +1,54 @@ +(defn score [before after] + (->> (map = before after) + (filter true? ,) + count)) + +(defn merge-vecs [init vecs] + (reduce (fn [counts [index x]] + (assoc counts x (conj (get counts x []) index))) + init vecs)) + +(defn frequency + "Returns a collection of indecies of distinct items" + [coll] + (->> (map-indexed vector coll) + (merge-vecs {} ,))) + +(defn group-indecies [s] + (->> (frequency s) + vals + (sort-by count ,) + reverse)) + +(defn cycles [coll] + (let [n (count (first coll)) + cycle (cycle (range n)) + coll (apply concat coll)] + (->> (map vector coll cycle) + (merge-vecs [] ,)))) + +(defn rotate [n coll] + (let [c (count coll) + n (rem (+ c n) c)] + (concat (drop n coll) (take n coll)))) + +(defn best-shuffle [s] + (let [ref (cycles (group-indecies s)) + prm (apply concat (map (partial rotate 1) ref)) + ref (apply concat ref)] + (->> (map vector ref prm) + (sort-by first ,) + (map second ,) + (map (partial get s) ,) + (apply str ,) + (#(vector s % (score s %)))))) + +user> (->> ["abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"] + (map best-shuffle ,) + vec) +[["abracadabra" "bdabararaac" 0] + ["seesaw" "eawess" 0] + ["elk" "lke" 0] + ["grrrrrr" "rgrrrrr" 5] + ["up" "pu" 0] + ["a" "a" 1]] diff --git a/Task/Best_shuffle/Go/best_shuffle.go b/Task/Best_shuffle/Go/best_shuffle.go new file mode 100644 index 0000000000..1126be2d4f --- /dev/null +++ b/Task/Best_shuffle/Go/best_shuffle.go @@ -0,0 +1,37 @@ +package main + +import ( + "fmt" + "math/rand" + "time" +) + +var ts = []string{"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"} + +func main() { + rand.Seed(time.Now().UnixNano()) + for _, s := range ts { + // create shuffled byte array of original string + t := make([]byte, len(s)) + for i, r := range rand.Perm(len(s)) { + t[i] = s[r] + } + // algorithm of Icon solution + for i := 0; i < len(s); i++ { + for j := 0; j < len(s); j++ { + if i != j && t[i] != s[j] && t[j] != s[i] { + t[i], t[j] = t[j], t[i] + break + } + } + } + // count unchanged and output + var count int + for i, ic := range t { + if ic == s[i] { + count++ + } + } + fmt.Printf("%s -> %s (%d)\n", s, string(t), count) + } +} diff --git a/Task/Best_shuffle/Haskell/best_shuffle-2.hs b/Task/Best_shuffle/Haskell/best_shuffle-2.hs new file mode 100644 index 0000000000..e15edcc5c5 --- /dev/null +++ b/Task/Best_shuffle/Haskell/best_shuffle-2.hs @@ -0,0 +1,2 @@ +bestShuffle :: Eq a => [a] -> [a] +bestShuffle s = minimumBy (compare `on` score s) $ permutations s diff --git a/Task/Best_shuffle/Haskell/best_shuffle.hs b/Task/Best_shuffle/Haskell/best_shuffle.hs new file mode 100644 index 0000000000..595cfbfb63 --- /dev/null +++ b/Task/Best_shuffle/Haskell/best_shuffle.hs @@ -0,0 +1,33 @@ +import Data.Function (on) +import Data.List +import Data.Maybe +import Data.Array +import Text.Printf + +main = mapM_ f examples + where examples = ["abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"] + f s = printf "%s, %s, (%d)\n" s s' $ score s s' + where s' = bestShuffle s + +score :: Eq a => [a] -> [a] -> Int +score old new = length $ filter id $ zipWith (==) old new + +bestShuffle :: (Ord a, Eq a) => [a] -> [a] +bestShuffle s = elems $ array bs $ f positions letters + where positions = + concat $ sortBy (compare `on` length) $ + map (map fst) $ groupBy ((==) `on` snd) $ + sortBy (compare `on` snd) $ zip [0..] s + letters = map (orig !) positions + + f [] [] = [] + f (p : ps) ls = (p, ls !! i) : f ps (removeAt i ls) + where i = fromMaybe 0 $ findIndex (/= o) ls + o = orig ! p + + orig = listArray bs s + bs = (0, length s - 1) + +removeAt :: Int -> [a] -> [a] +removeAt 0 (x : xs) = xs +removeAt i (x : xs) = x : removeAt (i - 1) xs diff --git a/Task/Best_shuffle/Java/best_shuffle.java b/Task/Best_shuffle/Java/best_shuffle.java new file mode 100644 index 0000000000..2195492059 --- /dev/null +++ b/Task/Best_shuffle/Java/best_shuffle.java @@ -0,0 +1,36 @@ +import java.util.*; + +public class BestShuffle { + + public static void main(String[] args) { + String[] words = {"abracadabra", "seesaw", "grrrrrr", "pop", "up", "a"}; + for (String w : words) + System.out.println(bestShuffle(w)); + } + + public static String bestShuffle(final String s1) { + char[] s2 = s1.toCharArray(); + Collections.shuffle(Arrays.asList(s2)); + for (int i = 0; i < s2.length; i++) { + if (s2[i] != s1.charAt(i)) + continue; + for (int j = 0; j < s2.length; j++) { + if (s2[i] != s2[j] && s2[i] != s1.charAt(j) && s2[j] != s1.charAt(i)) { + char tmp = s2[i]; + s2[i] = s2[j]; + s2[j] = tmp; + break; + } + } + } + return s1 + " " + new String(s2) + " (" + count(s1, s2) + ")"; + } + + private static int count(final String s1, final char[] s2) { + int count = 0; + for (int i = 0; i < s2.length; i++) + if (s1.charAt(i) == s2[i]) + count++; + return count; + } +} diff --git a/Task/Best_shuffle/JavaScript/best_shuffle-2.js b/Task/Best_shuffle/JavaScript/best_shuffle-2.js new file mode 100644 index 0000000000..b0d1e69c96 --- /dev/null +++ b/Task/Best_shuffle/JavaScript/best_shuffle-2.js @@ -0,0 +1,7 @@ +

+
diff --git a/Task/Best_shuffle/JavaScript/best_shuffle-3.js b/Task/Best_shuffle/JavaScript/best_shuffle-3.js
new file mode 100644
index 0000000000..ddcdbcc7c2
--- /dev/null
+++ b/Task/Best_shuffle/JavaScript/best_shuffle-3.js
@@ -0,0 +1,6 @@
+abracadabra, raababacdar, (0)
+seesaw, ewaess, (0)
+elk, lke, (0)
+grrrrrr, rrrrrgr, (5)
+up, pu, (0)
+a, a, (1)
diff --git a/Task/Best_shuffle/JavaScript/best_shuffle.js b/Task/Best_shuffle/JavaScript/best_shuffle.js
new file mode 100644
index 0000000000..b3ce16e066
--- /dev/null
+++ b/Task/Best_shuffle/JavaScript/best_shuffle.js
@@ -0,0 +1,47 @@
+function raze(a) { // like .join('') except producing an array instead of a string
+    var r= [];
+    for (var j= 0; j';
+
+function bestShuffle($s1) {
+    $s2 = str_shuffle($s1);
+    for ($i = 0; $i < strlen($s2); $i++) {
+        if ($s2[$i] != $s1[$i]) continue;
+        for ($j = 0; $j < strlen($s2); $j++)
+            if ($i != $j && $s2[$i] != $s1[$j] && $s2[$j] != $s1[$i]) {
+                $t = $s2[$i];
+                $s2[$i] = $s2[$j];
+                $s2[$j] = $t;
+                break;
+            }
+    }
+    return "$s1 $s2 " . countSame($s1, $s2);
+}
+
+function countSame($s1, $s2) {
+    $cnt = 0;
+    for ($i = 0; $i < strlen($s2); $i++)
+        if ($s1[$i] == $s2[$i])
+            $cnt++;
+    return "($cnt)";
+}
diff --git a/Task/Best_shuffle/Perl/best_shuffle.pl b/Task/Best_shuffle/Perl/best_shuffle.pl
new file mode 100644
index 0000000000..d45fe26114
--- /dev/null
+++ b/Task/Best_shuffle/Perl/best_shuffle.pl
@@ -0,0 +1,38 @@
+use strict;
+use Algorithm::Permute;
+
+foreach ("abracadabra", "seesaw", "elk", "grrrrrr", "up", "a") {
+    best_shuffle($_);
+}
+
+sub score {
+    my ($original_word,$new_word) = @_;
+    my $result = 0;
+    for (my $i = 0 ; $i < length($original_word) ; $i++) {
+        if (substr($original_word,$i,1) eq substr($new_word,$i,1)) {
+            $result++;
+        }
+    }
+    return $result;
+}
+
+sub best_shuffle {
+    my ($original_word) = @_;
+    my $best_word = $original_word;
+    my $best_score = length($original_word);
+    my @array = split(//,$original_word);
+
+    # The below was adapted from perlfaq4
+
+    my $p_iterator = Algorithm::Permute->new( \@array );
+
+    while (my @array = $p_iterator->next) {
+        if (score($original_word,join("",@array))<$best_score) {
+            $best_score = score($original_word, join("",@array));
+            $best_word = join ("",@array);
+        }
+        last if ($best_score == 0);
+    }
+
+    print "$original_word, $best_word, $best_score\n";
+}
diff --git a/Task/Best_shuffle/PicoLisp/best_shuffle.l b/Task/Best_shuffle/PicoLisp/best_shuffle.l
new file mode 100644
index 0000000000..6dedad553f
--- /dev/null
+++ b/Task/Best_shuffle/PicoLisp/best_shuffle.l
@@ -0,0 +1,14 @@
+(de bestShuffle (Str)
+   (let Lst NIL
+      (for C (setq Str (chop Str))
+         (if (assoc C Lst)
+            (con @ (cons C (cdr @)))
+            (push 'Lst (cons C)) ) )
+      (setq Lst (apply conc (flip (by length sort Lst))))
+      (let Res
+         (mapcar
+            '((C)
+               (prog1 (or (find <> Lst (circ C)) C)
+                  (setq Lst (delete @ Lst)) ) )
+            Str )
+         (prinl Str " " Res " (" (cnt = Str Res) ")") ) ) )
diff --git a/Task/Best_shuffle/Prolog/best_shuffle.pro b/Task/Best_shuffle/Prolog/best_shuffle.pro
new file mode 100644
index 0000000000..078f3ac787
--- /dev/null
+++ b/Task/Best_shuffle/Prolog/best_shuffle.pro
@@ -0,0 +1,74 @@
+:- dynamic score/2.
+
+best_shuffle :-
+	maplist(best_shuffle, ["abracadabra", "eesaw", "elk", "grrrrrr",
+			       	"up", "a"]).
+
+best_shuffle(Str) :-
+	retractall(score(_,_)),
+	length(Str, Len),
+	assert(score(Str, Len)),
+	calcule_min(Str, Len, Min),
+	repeat,
+	   shuffle(Str, Shuffled),
+	   maplist(comp, Str, Shuffled, Result),
+	   sumlist(Result, V),
+	   retract(score(Cur, VCur)),
+	   (  V < VCur -> assert(score(Shuffled, V)); assert(score(Cur, VCur))),
+	   V = Min,
+	retract(score(Cur, VCur)),
+	writef('%s : %s (%d)\n', [Str, Cur, VCur]).
+
+comp(C, C1, S):-
+	(   C = C1 -> S = 1; S = 0).
+
+% this code was written by P.Caboche and can be found here :
+% http://pcaboche.developpez.com/article/prolog/listes/?page=page_3#Lshuffle
+shuffle(List, Shuffled) :-
+  length(List, Len),
+  shuffle(Len, List, Shuffled).
+
+shuffle(0, [], []) :- !.
+
+shuffle(Len, List, [Elem|Tail]) :-
+  RandInd is random(Len),
+  nth0(RandInd, List, Elem),
+  select(Elem, List, Rest),
+  NewLen is Len - 1,
+  shuffle(NewLen, Rest, Tail).
+
+
+% letters are sorted out then packed
+% If a letter is more numerous than the rest
+% the min is the difference between the quantity of this letter and
+% the sum of the quantity of the other letters
+calcule_min(Str, Len, Min) :-
+	msort(Str, SS),
+	packList(SS, Lst),
+	sort(Lst, Lst1),
+	last(Lst1, [N, _]),
+	(   N * 2 > Len -> Min is 2 * N - Len; Min = 0).
+
+
+
+% almost the same code as in "run_length" page
+packList([],[]).
+
+packList([X],[[1,X]]) :- !.
+
+
+packList([X|Rest],[XRun|Packed]):-
+    run(X,Rest, XRun,RRest),
+    packList(RRest,Packed).
+
+
+run(Var,[],[1,Var],[]).
+
+run(Var,[Var|LRest],[N1, Var],RRest):-
+    run(Var,LRest,[N, Var],RRest),
+    N > 0,
+    N1 is N + 1.
+
+
+run(Var,[Other|RRest], [1,Var],[Other|RRest]):-
+     dif(Var,Other).
diff --git a/Task/Best_shuffle/Python/best_shuffle-2.py b/Task/Best_shuffle/Python/best_shuffle-2.py
new file mode 100644
index 0000000000..f300254142
--- /dev/null
+++ b/Task/Best_shuffle/Python/best_shuffle-2.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+def best_shuffle(s):
+    # Count the supply of characters.
+    from collections import defaultdict
+    count = defaultdict(int)
+    for c in s:
+        count[c] += 1
+
+    # Shuffle the characters.
+    r = []
+    for x in s:
+        # Find the best character to replace x.
+        best = None
+        rankb = -2
+        for c, rankc in count.items():
+            # Prefer characters with more supply.
+            # (Save characters with less supply.)
+            # Avoid identical characters.
+            if c == x: rankc = -1
+            if rankc > rankb:
+                best = c
+                rankb = rankc
+
+        # Add character to list. Remove it from supply.
+        r.append(best)
+        count[best] -= 1
+        if count[best] == 0: del count[best]
+
+    # If the final letter became stuck (as "ababcd" became "bacabd",
+    # and the final "d" became stuck), then fix it.
+    i = len(s) - 1
+    if r[i] == s[i]:
+        for j in range(i):
+            if r[i] != s[j] and r[j] != s[i]:
+                r[i], r[j] = r[j], r[i]
+                break
+
+    # Convert list to string. PEP 8, "Style Guide for Python Code",
+    # suggests that ''.join() is faster than + when concatenating
+    # many strings. See http://www.python.org/dev/peps/pep-0008/
+    r = ''.join(r)
+
+    score = sum(x == y for x, y in zip(r, s))
+
+    return (r, score)
+
+for s in "abracadabra", "seesaw", "elk", "grrrrrr", "up", "a":
+    shuffled, score = best_shuffle(s)
+    print("%s, %s, (%d)" % (s, shuffled, score))
diff --git a/Task/Best_shuffle/Python/best_shuffle.py b/Task/Best_shuffle/Python/best_shuffle.py
new file mode 100644
index 0000000000..4b248965a0
--- /dev/null
+++ b/Task/Best_shuffle/Python/best_shuffle.py
@@ -0,0 +1,28 @@
+from collections import Counter
+import random
+
+def count(w1,wnew):
+    return sum(c1==c2 for c1,c2 in zip(w1, wnew))
+
+def best_shuffle(w):
+    wnew = list(w)
+    n = len(w)
+    rangelists = (list(range(n)), list(range(n)))
+    for r in rangelists:
+        random.shuffle(r)
+    rangei, rangej = rangelists
+    for i in rangei:
+        for j in rangej:
+            if i != j and wnew[j] != wnew[i] and w[i] != wnew[j] and w[j] != wnew[i]:
+                wnew[j], wnew[i] = wnew[i], wnew[j]
+    wnew = ''.join(wnew)
+    return wnew, count(w, wnew)
+
+
+if __name__ == '__main__':
+    test_words = ('tree abracadabra seesaw elk grrrrrr up a '
+                  + 'antidisestablishmentarianism hounddogs').split()
+    test_words += ['aardvarks are ant eaters', 'immediately', 'abba']
+    for w in test_words:
+        wnew, c = best_shuffle(w)
+        print("%29s, %-29s ,(%i)" % (w, wnew, c))
diff --git a/Task/Best_shuffle/REXX/best_shuffle-2.rexx b/Task/Best_shuffle/REXX/best_shuffle-2.rexx
new file mode 100644
index 0000000000..c39f7425d1
--- /dev/null
+++ b/Task/Best_shuffle/REXX/best_shuffle-2.rexx
@@ -0,0 +1,37 @@
+def best_shuffle(s)
+  # Fill _pos_ with positions in the order
+  # that we want to fill them.
+  pos = []
+  # g["a"] = [2, 4] implies that s[2] == s[4] == "a"
+  g = (0...s.length).group_by { |i| s[i] }
+
+  # k sorts letters from low to high count
+  k = g.sort_by { |k, v| v.length }.map! { |k, v| k }
+
+  until g.empty?
+    k.each { |letter|
+      g[letter] or next
+      pos.push(g[letter].pop)
+      g[letter].empty? and g.delete letter
+    }
+  end
+  pos.reverse!
+
+  # Now fill in _new_ with _letters_ according to each position
+  # in _pos_, but skip ahead in _letters_ if we can avoid
+  # matching characters that way.
+  letters = s.dup
+  new = "?" * s.length
+  until letters.empty?
+    i, p = 0, pos.shift
+    i += 1 while letters[i] == s[p] and i < (letters.length - 1)
+    new[p] = letters.slice! i
+  end
+
+  score = new.chars.zip(s.chars).count { |c, d| c == d }
+  [new, score]
+end
+
+%w(abracadabra seesaw elk grrrrrr up a).each { |word|
+  printf "%s, %s, (%d)\n", word, *best_shuffle(word)
+}
diff --git a/Task/Best_shuffle/REXX/best_shuffle-3.rexx b/Task/Best_shuffle/REXX/best_shuffle-3.rexx
new file mode 100644
index 0000000000..d7eb9abdc9
--- /dev/null
+++ b/Task/Best_shuffle/REXX/best_shuffle-3.rexx
@@ -0,0 +1,25 @@
+list$ = "abracadabra seesaw pop grrrrrr up a"
+
+while word$(list$,ii + 1," ") <> ""
+ ii    = ii + 1
+ w$    = word$(list$,ii," ")
+ bs$   = bestShuffle$(w$)
+ count = 0
+ for i = 1 to len(w$)
+  if mid$(w$,i,1) = mid$(bs$,i,1) then count = count + 1
+ next i
+ print  w$;" ";bs$;" ";count
+wend
+
+function bestShuffle$(s1$)
+   s2$   = s1$
+   for i = 1 to len(s2$)
+        for j =  1 to len(s2$)
+            if (i <> j) and (mid$(s2$,i,1) <> mid$(s1$,j,1)) and (mid$(s2$,j,1) <> mid$(s1$,i,1)) then
+            if j < i then i1 = j:j1 = i else i1 = i:j1 = j
+            s2$ = left$(s2$,i1-1) + mid$(s2$,j1,1) + mid$(s2$,i1+1,(j1-i1)-1) + mid$(s2$,i1,1) + mid$(s2$,j1+1)
+            end if
+        next j
+   next i
+bestShuffle$ = s2$
+end function
diff --git a/Task/Best_shuffle/REXX/best_shuffle.rexx b/Task/Best_shuffle/REXX/best_shuffle.rexx
new file mode 100644
index 0000000000..0b7972085c
--- /dev/null
+++ b/Task/Best_shuffle/REXX/best_shuffle.rexx
@@ -0,0 +1,42 @@
+/*REXX program to find the best shuffle  (for a character string).      */
+parse arg list                         /*get words from the command line*/
+if list='' then list='tree abracadabra seesaw elk grrrrrr up a'  /*def.?*/
+w=0                                    /*widest word , for prettifing.  */
+        do i=1  for words(list)
+        w=max(w,length(word(list,i)))  /*the maximum word width so far. */
+        end   /*i*/
+w=w+5                                  /*add five spaces to widest word.*/
+        do n=1  for words(list)        /*process the words in the list. */
+        $=word(list,n)                 /*the original word in the list. */
+        new=bestShuffle($)             /*shufflized version of the word.*/
+        say 'original:' left($,w) 'new:' left(new,w) 'count:' kSame($,new)
+        end   /*n*/
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────BESTSHUFFLE subroutine──────────────*/
+bestShuffle: procedure;    parse arg x 1 ox;    Lx=length(x)
+if Lx<3 then return reverse(x)         /*fast track these puppies.      */
+
+   do j=1  for Lx-1                    /*first take care of replications*/
+   a=substr(x,j  ,1)
+   b=substr(x,j+1,1);          if a\==b then iterate
+   _=verify(x,a); if _==0 then iterate /*switch 1st rep with some char. */
+   y=substr(x,_,1);      x=overlay(a,x,_)
+                         x=overlay(y,x,j)
+   rx=reverse(x); _=verify(rx,a); if _==0 then iterate   /*¬ enuf unique*/
+   y=substr(rx,_,1);  _=lastpos(y,x)   /*switch 2nd rep with later char.*/
+   x=overlay(a,x,_);  x=overlay(y,x,j+1)  /*OVERLAYs: a fast way to swap*/
+   end    /*j*/
+
+           do k=1  for Lx              /*take care of same o'-same o's. */
+           a=substr(x, k,1)
+           b=substr(ox,k,1);   if a\==b then iterate
+           if k==Lx then x=left(x,k-2)a || substr(x,k-1,1)   /*last case*/
+                    else x=left(x,k-1)substr(x,k+1,1)a || substr(x,k+2)
+           end   /*k*/
+return x
+/*──────────────────────────────────KSAME procedure─────────────────────*/
+kSame: procedure;    parse arg x,y;    k=0
+                  do m=1  for min(length(x),length(y))
+                  k=k + (substr(x,m,1) == substr(y,m,1))
+                  end   /*m*/
+return k
diff --git a/Task/Best_shuffle/Racket/best_shuffle.rkt b/Task/Best_shuffle/Racket/best_shuffle.rkt
new file mode 100644
index 0000000000..5cb2b2e797
--- /dev/null
+++ b/Task/Best_shuffle/Racket/best_shuffle.rkt
@@ -0,0 +1,20 @@
+#lang racket
+
+(define (best-shuffle s)
+  (define len (string-length s))
+  (define @ string-ref)
+  (define r (list->string (shuffle (string->list s))))
+  (for* ([i (in-range len)] [j (in-range len)])
+    (when (not (or (= i j) (eq? (@ s i) (@ r j)) (eq? (@ s j) (@ r i))))
+      (define t (@ r i))
+      (string-set! r i (@ r j))
+      (string-set! r j t)))
+  r)
+
+(define (count-same s1 s2)
+  (for/sum ([c1 (in-string s1)] [c2 (in-string s2)])
+    (if (eq? c1 c2) 1 0)))
+
+(for ([s (in-list '("tree" "abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"))])
+  (define sh (best-shuffle s))
+  (printf " ~a, ~a, (~a)\n" s sh (count-same s sh)))
diff --git a/Task/Best_shuffle/Scheme/best_shuffle.ss b/Task/Best_shuffle/Scheme/best_shuffle.ss
new file mode 100644
index 0000000000..4b94520b93
--- /dev/null
+++ b/Task/Best_shuffle/Scheme/best_shuffle.ss
@@ -0,0 +1,65 @@
+(define count
+  (lambda (str1 str2)
+    (let ((len (string-length str1)))
+      (let loop ((index 0)
+                 (result 0))
+        (if (= index len)
+            result
+            (loop (+ index 1)
+                  (if (eq? (string-ref str1 index)
+                           (string-ref str2 index))
+                      (+ result 1)
+                      result)))))))
+
+(define swap
+  (lambda (str index1 index2)
+    (let ((mutable (string-copy str))
+          (char1 (string-ref str index1))
+          (char2 (string-ref str index2)))
+      (string-set! mutable index1 char2)
+      (string-set! mutable index2 char1)
+      mutable)))
+
+(define shift
+  (lambda (str)
+    (string-append (substring str 1 (string-length str))
+                   (substring str 0 1))))
+
+(define shuffle
+  (lambda (str)
+    (let* ((mutable (shift str))
+           (len (string-length mutable))
+           (max-index (- len 1)))
+      (let outer ((index1 0)
+                  (best mutable)
+                  (best-count (count str mutable)))
+        (if (or (< max-index index1)
+                (= best-count 0))
+            best
+            (let inner ((index2 (+ index1 1))
+                        (best best)
+                        (best-count best-count))
+              (if (= len index2)
+                  (outer (+ index1 1)
+                         best
+                         best-count)
+                  (let* ((next-mutable (swap best index1 index2))
+                         (next-count (count str next-mutable)))
+                    (if (= 0 next-count)
+                        next-mutable
+                        (if (< next-count best-count)
+                            (inner (+ index2 1)
+                                   next-mutable
+                                   next-count)
+                            (inner (+ index2 1)
+                                   best
+                                   best-count)))))))))))
+
+
+(for-each
+ (lambda (str)
+   (let ((shuffled (shuffle str)))
+     (display
+      (string-append str " " shuffled " ("
+                     (number->string (count str shuffled)) ")\n"))))
+ '("abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"))
diff --git a/Task/Best_shuffle/Tcl/best_shuffle-2.tcl b/Task/Best_shuffle/Tcl/best_shuffle-2.tcl
new file mode 100644
index 0000000000..d2cd1559a0
--- /dev/null
+++ b/Task/Best_shuffle/Tcl/best_shuffle-2.tcl
@@ -0,0 +1,3 @@
+foreach sample {abracadabra seesaw elk grrrrrr up a} {
+    puts [bestshuffle $sample]
+}
diff --git a/Task/Best_shuffle/Tcl/best_shuffle.tcl b/Task/Best_shuffle/Tcl/best_shuffle.tcl
new file mode 100644
index 0000000000..3408252153
--- /dev/null
+++ b/Task/Best_shuffle/Tcl/best_shuffle.tcl
@@ -0,0 +1,21 @@
+package require Tcl 8.5
+package require struct::list
+
+# Simple metric function; assumes non-empty lists
+proc count {l1 l2} {
+    foreach a $l1 b $l2 {incr total [string equal $a $b]}
+    return $total
+}
+# Find the best shuffling of the string
+proc bestshuffle {str} {
+    set origin [split $str ""]
+    set best $origin
+    set score [llength $origin]
+    struct::list foreachperm p $origin {
+	if {$score > [set score [tcl::mathfunc::min $score [count $origin $p]]]} {
+	    set best $p
+	}
+    }
+    set best [join $best ""]
+    return "$str,$best,($score)"
+}
diff --git a/Task/Binary_digits/0DESCRIPTION b/Task/Binary_digits/0DESCRIPTION
new file mode 100644
index 0000000000..1726825478
--- /dev/null
+++ b/Task/Binary_digits/0DESCRIPTION
@@ -0,0 +1,7 @@
+The task is to output the sequence of binary digits for a given [[wp:Natural number|non-negative integer]].
+
+The decimal value 5, should produce an output of 101
+The decimal value 50 should produce an output of 110010
+The decimal value 9000 should produce an output of 10001100101000
+
+The results can be achieved using builtin radix functions within the language, if these are available, or alternatively a user defined function can be used. The output produced should consist just of the binary digits of each number followed by a newline. There should be no other whitespace, radix or sign markers in the produced output, and [[wp:Leading zero|leading zeros]] should not appear in the results.
diff --git a/Task/Binary_digits/1META.yaml b/Task/Binary_digits/1META.yaml
new file mode 100644
index 0000000000..4f4b33e2dd
--- /dev/null
+++ b/Task/Binary_digits/1META.yaml
@@ -0,0 +1,4 @@
+---
+category:
+- Radices
+note: Basic language learning
diff --git a/Task/Binary_digits/AWK/binary_digits.awk b/Task/Binary_digits/AWK/binary_digits.awk
new file mode 100644
index 0000000000..34b883eee5
--- /dev/null
+++ b/Task/Binary_digits/AWK/binary_digits.awk
@@ -0,0 +1,23 @@
+BEGIN {
+  print tobinary(5)
+  print tobinary(50)
+  print tobinary(9000)
+}
+
+function tobinary(num) {
+  outstr = ""
+  l = num
+  while ( l ) {
+    if ( l%2 == 0 ) {
+      outstr = "0" outstr
+    } else {
+      outstr = "1" outstr
+    }
+    l = int(l/2)
+  }
+  # Make sure we output a zero for a value of zero
+  if ( outstr == "" ) {
+    outstr = "0"
+  }
+  return outstr
+}
diff --git a/Task/Binary_digits/C/binary_digits-2.c b/Task/Binary_digits/C/binary_digits-2.c
new file mode 100644
index 0000000000..70aef3c276
--- /dev/null
+++ b/Task/Binary_digits/C/binary_digits-2.c
@@ -0,0 +1,30 @@
+#include 
+
+void IntToBitString(unsigned int number)
+{
+    int num_bits = sizeof(unsigned int) * 8;
+
+    bool startPrinting = false;
+    for (int bit_pos=num_bits-1; bit_pos >= 0; bit_pos--)
+    {
+        bool isBitSet = (number & (1<
+
+void bin(int x, char *s)
+{
+	char*_(int x){
+		*(s = x ? _(x >> 1) : s) = (x & 1) + '0';
+		return ++s;
+	}
+	*_(x) = 0;
+}
+
+int main()
+{
+	char a[100];
+	int i;
+	for (i = 0; i <= 1984; i += 31)
+		bin(i, a), printf("%4d: %s\n", i, a);
+
+	return 0;
+}
diff --git a/Task/Binary_digits/Clojure/binary_digits.clj b/Task/Binary_digits/Clojure/binary_digits.clj
new file mode 100644
index 0000000000..24442039f6
--- /dev/null
+++ b/Task/Binary_digits/Clojure/binary_digits.clj
@@ -0,0 +1,3 @@
+(Integer/toBinaryString 5)
+(Integer/toBinaryString 50)
+(Integer/toBinaryString 9000)
diff --git a/Task/Binary_digits/CoffeeScript/binary_digits.coffee b/Task/Binary_digits/CoffeeScript/binary_digits.coffee
new file mode 100644
index 0000000000..02cff299fc
--- /dev/null
+++ b/Task/Binary_digits/CoffeeScript/binary_digits.coffee
@@ -0,0 +1,4 @@
+binary = (n) ->
+  new Number(n).toString(2)
+
+console.log binary n for n in [5, 50, 9000]
diff --git a/Task/Binary_digits/Erlang/binary_digits.erl b/Task/Binary_digits/Erlang/binary_digits.erl
new file mode 100644
index 0000000000..e6c3840b6c
--- /dev/null
+++ b/Task/Binary_digits/Erlang/binary_digits.erl
@@ -0,0 +1 @@
+lists:map( fun(N) -> io:fwrite("~.2B~n", [N]) end, [5, 50, 9000]).
diff --git a/Task/Binary_digits/Forth/binary_digits.fth b/Task/Binary_digits/Forth/binary_digits.fth
new file mode 100644
index 0000000000..fa90e5a700
--- /dev/null
+++ b/Task/Binary_digits/Forth/binary_digits.fth
@@ -0,0 +1,4 @@
+9000 50 5
+2 base !
+. . .
+decimal
diff --git a/Task/Binary_digits/Go/binary_digits.go b/Task/Binary_digits/Go/binary_digits.go
new file mode 100644
index 0000000000..2d75ea6054
--- /dev/null
+++ b/Task/Binary_digits/Go/binary_digits.go
@@ -0,0 +1,11 @@
+package main
+
+import (
+	"fmt"
+)
+
+func main() {
+	for i := 0; i < 16; i++ {
+		fmt.Printf("%b\n", i)
+	}
+}
diff --git a/Task/Binary_digits/Haskell/binary_digits.hs b/Task/Binary_digits/Haskell/binary_digits.hs
new file mode 100644
index 0000000000..fcf217e471
--- /dev/null
+++ b/Task/Binary_digits/Haskell/binary_digits.hs
@@ -0,0 +1,16 @@
+import Data.List
+import Numeric
+import Text.Printf
+
+-- Use the built-in function showIntAtBase.
+toBin n = showIntAtBase 2 ("01" !!) n ""
+
+-- Implement our own version.
+toBin' 0 = []
+toBin' x =  (toBin' $ x `div` 2) ++ (show $ x `mod` 2)
+
+printToBin n = putStrLn $ printf "%4d  %14s  %14s" n (toBin n) (toBin' n)
+
+main = do
+  putStrLn $ printf "%4s  %14s  %14s" "N" "toBin" "toBin'"
+  mapM_ printToBin [5, 50, 9000]
diff --git a/Task/Binary_digits/Java/binary_digits.java b/Task/Binary_digits/Java/binary_digits.java
new file mode 100644
index 0000000000..5935d3606c
--- /dev/null
+++ b/Task/Binary_digits/Java/binary_digits.java
@@ -0,0 +1,7 @@
+public class Main {
+    public static void main(String[] args) {
+        System.out.println(Integer.toBinaryString(5));
+        System.out.println(Integer.toBinaryString(50));
+        System.out.println(Integer.toBinaryString(9000));
+    }
+}
diff --git a/Task/Binary_digits/JavaScript/binary_digits.js b/Task/Binary_digits/JavaScript/binary_digits.js
new file mode 100644
index 0000000000..a117653a9d
--- /dev/null
+++ b/Task/Binary_digits/JavaScript/binary_digits.js
@@ -0,0 +1,7 @@
+function toBinary(number) {
+  return new Number(number).toString(2);
+}
+var demoValues = [5, 50, 9000];
+for (var i=0; i "101"
+
+: (bin 50)
+-> "110010"
+
+: (bin 9000)
+-> "10001100101000"
diff --git a/Task/Binary_digits/Python/binary_digits-2.py b/Task/Binary_digits/Python/binary_digits-2.py
new file mode 100644
index 0000000000..1ad92d4db0
--- /dev/null
+++ b/Task/Binary_digits/Python/binary_digits-2.py
@@ -0,0 +1,18 @@
+>>> for i in range(16): print(bin(i))
+
+0b0
+0b1
+0b10
+0b11
+0b100
+0b101
+0b110
+0b111
+0b1000
+0b1001
+0b1010
+0b1011
+0b1100
+0b1101
+0b1110
+0b1111
diff --git a/Task/Binary_digits/Python/binary_digits-3.py b/Task/Binary_digits/Python/binary_digits-3.py
new file mode 100644
index 0000000000..742e2ecbe8
--- /dev/null
+++ b/Task/Binary_digits/Python/binary_digits-3.py
@@ -0,0 +1,20 @@
+>>> oct2bin = {'0': '000', '1': '001', '2': '010', '3': '011', '4': '100', '5': '101', '6': '110', '7': '111'}
+>>> bin = lambda n: ''.join(oct2bin[octdigit] for octdigit in '%o' % n).lstrip('0') or '0'
+>>> for i in range(16): print(bin(i))
+
+0
+1
+10
+11
+100
+101
+110
+111
+1000
+1001
+1010
+1011
+1100
+1101
+1110
+1111
diff --git a/Task/Binary_digits/Python/binary_digits.py b/Task/Binary_digits/Python/binary_digits.py
new file mode 100644
index 0000000000..01f520b4d0
--- /dev/null
+++ b/Task/Binary_digits/Python/binary_digits.py
@@ -0,0 +1,18 @@
+>>> for i in range(16): print('{0:b}'.format(i))
+
+0
+1
+10
+11
+100
+101
+110
+111
+1000
+1001
+1010
+1011
+1100
+1101
+1110
+1111
diff --git a/Task/Binary_digits/Racket/binary_digits.rkt b/Task/Binary_digits/Racket/binary_digits.rkt
new file mode 100644
index 0000000000..ce748521d8
--- /dev/null
+++ b/Task/Binary_digits/Racket/binary_digits.rkt
@@ -0,0 +1,3 @@
+#lang racket
+(for ([i 16])
+  (displayln (number->string i 2)))
diff --git a/Task/Binary_search/0DESCRIPTION b/Task/Binary_search/0DESCRIPTION
new file mode 100644
index 0000000000..62772bf0a3
--- /dev/null
+++ b/Task/Binary_search/0DESCRIPTION
@@ -0,0 +1,140 @@
+A binary search divides a range of values into halves, and continues to narrow down the field of search until the unknown value is found. It is the classic example of a "divide and conquer" algorithm.
+
+As an analogy, consider the children's game "[[Guess the number/With feedback|guess a number]]."  The scorer has a secret number, and will only tell the player if their guessed number is higher than, lower than, or equal to the secret number. The player then uses this information to guess a new number.
+
+As the player, an optimal strategy for the general case is to start by choosing the range's midpoint as the guess, and then asking whether the guess was higher, lower, or equal to the secret number. If the guess was too high, one would select the point exactly between the range midpoint and the beginning of the range. If the original guess was too low, one would ask about the point exactly between the range midpoint and the end of the range. This process repeats until one has reached the secret number.
+
+'''The Task'''
+
+Given the starting point of a range, the ending point of a range, and the "secret value", implement a binary search through a sorted integer array for a certain number. Implementations can be recursive or iterative (both if you can). Print out whether or not the number was in the array afterwards. If it was, print the index also.
+
+There are several binary search algorithms commonly seen. They differ by how they treat multiple values equal to the given value, and whether they indicate whether the element was found or not. For completeness we will present pseudocode for all of them.
+
+All of the following code examples use an "inclusive" upper bound (i.e. high = N-1 initially). Any of the examples can be converted into an equivalent example using "exclusive" upper bound (i.e. high = N initially) by making the following simple changes (which simply increase high by 1):
+* change high = N-1 to high = N
+* change high = mid-1 to high = mid
+* (for recursive algorithm) change if (high < low) to if (high <= low)
+* (for iterative algorithm) change while (low <= high) to while (low < high)
+
+; Traditional algorithm
+The algorithms are as follows (from [[wp:Binary search|Wikipedia]]). The algorithms return the index of some element that equals the given value (if there are multiple such elements, it returns some arbitrary one). It is also possible, when the element is not found, to return the "insertion point" for it (the index that the value would have if it were inserted into the array).
+
+'''Recursive Pseudocode''':
+   // initially called with low = 0, high = N-1
+   BinarySearch(A[0..N-1], value, low, high) {
+       // invariants: value > A[i] for all i < low
+                      value < A[i] for all i > high
+       if (high < low)
+           return not_found // value would be inserted at index "low"
+       mid = (low + high) / 2
+       if (A[mid] > value)
+           return BinarySearch(A, value, low, mid-1)
+       else if (A[mid] < value)
+           return BinarySearch(A, value, mid+1, high)
+       else
+           return mid
+   }
+
+'''Iterative Pseudocode''':
+   BinarySearch(A[0..N-1], value) {
+       low = 0
+       high = N - 1
+       while (low <= high) {
+           // invariants: value > A[i] for all i < low
+                          value < A[i] for all i > high
+           mid = (low + high) / 2
+           if (A[mid] > value)
+               high = mid - 1
+           else if (A[mid] < value)
+               low = mid + 1
+           else
+               return mid
+       }
+       return not_found // value would be inserted at index "low"
+   }
+
+; Leftmost insertion point
+The following algorithms return the leftmost place where the given element can be correctly inserted (and still maintain the sorted order). This is the lower (inclusive) bound of the range of elements that are equal to the given value (if any). Equivalently, this is the lowest index where the element is greater than or equal to the given value (since if it were any lower, it would violate the ordering), or 1 past the last index if such an element does not exist. This algorithm does not determine if the element is actually found. This algorithm only requires one comparison per level.
+
+'''Recursive Pseudocode''':
+   // initially called with low = 0, high = N - 1
+   BinarySearch_Left(A[0..N-1], value, low, high) {
+       // invariants: value > A[i] for all i < low
+                      value <= A[i] for all i > high
+       if (high < low)
+           return low
+       mid = (low + high) / 2
+       if (A[mid] >= value)
+           return BinarySearch_Left(A, value, low, mid-1)
+       else
+           return BinarySearch_Left(A, value, mid+1, high)
+   }
+
+'''Iterative Pseudocode''':
+   BinarySearch_Left(A[0..N-1], value) {
+       low = 0
+       high = N - 1
+       while (low <= high) {
+           // invariants: value > A[i] for all i < low
+                          value <= A[i] for all i > high
+           mid = (low + high) / 2
+           if (A[mid] >= value)
+               high = mid - 1
+           else
+               low = mid + 1
+       }
+       return low
+   }
+
+; Rightmost insertion point
+The following algorithms return the rightmost place where the given element can be correctly inserted (and still maintain the sorted order). This is the upper (exclusive) bound of the range of elements that are equal to the given value (if any). Equivalently, this is the lowest index where the element is greater than the given value, or 1 past the last index if such an element does not exist. This algorithm does not determine if the element is actually found. This algorithm only requires one comparison per level. Note that these algorithms are almost exactly the same as the leftmost-insertion-point algorithms, except for how the inequality treats equal values.
+
+'''Recursive Pseudocode''':
+   // initially called with low = 0, high = N - 1
+   BinarySearch_Right(A[0..N-1], value, low, high) {
+       // invariants: value >= A[i] for all i < low
+                      value < A[i] for all i > high
+       if (high < low)
+           return low
+       mid = (low + high) / 2
+       if (A[mid] > value)
+           return BinarySearch_Right(A, value, low, mid-1)
+       else
+           return BinarySearch_Right(A, value, mid+1, high)
+   }
+
+'''Iterative Pseudocode''':
+   BinarySearch_Right(A[0..N-1], value) {
+       low = 0
+       high = N - 1
+       while (low <= high) {
+           // invariants: value >= A[i] for all i < low
+                          value < A[i] for all i > high
+           mid = (low + high) / 2
+           if (A[mid] > value)
+               high = mid - 1
+           else
+               low = mid + 1
+       }
+       return low
+   }
+
+;Extra credit
+Make sure it does not have overflow bugs.
+
+The line in the pseudocode above to calculate the mean of two integers:
+
mid = (low + high) / 2
+could produce the wrong result in some programming languages when used with a bounded integer type, if the addition causes an overflow. (This can occur if the array size is greater than half the maximum integer value.) If signed integers are used, and low + high overflows, it becomes a negative number, and dividing by 2 will still result in a negative number. Indexing an array with a negative number could produce an out-of-bounds exception, or other undefined behavior. If unsigned integers are used, an overflow will result in losing the largest bit, which will produce the wrong result. + +One way to fix it is to manually add half the range to the low number: +
mid = low + (high - low) / 2
+Even though this is mathematically equivalent to the above, it is not susceptible to overflow. + +Another way for signed integers, possibly faster, is the following: +
mid = (low + high) >>> 1
+where >>> is the logical right shift operator. The reason why this works is that, for signed integers, even though it overflows, when viewed as an unsigned number, the value is still the correct sum. To divide an unsigned number by 2, simply do a logical right shift. + +'''References:'''
+:* C.f: [[Guess the number/With Feedback (Player)]] +:* [[wp:Binary search algorithm]] +:* [http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken]. diff --git a/Task/Binary_search/1META.yaml b/Task/Binary_search/1META.yaml new file mode 100644 index 0000000000..0d2b469697 --- /dev/null +++ b/Task/Binary_search/1META.yaml @@ -0,0 +1,4 @@ +--- +category: +- Recursion +note: Classic CS problems and programs diff --git a/Task/Binary_search/AWK/binary_search-2.awk b/Task/Binary_search/AWK/binary_search-2.awk new file mode 100644 index 0000000000..9320c09ca3 --- /dev/null +++ b/Task/Binary_search/AWK/binary_search-2.awk @@ -0,0 +1,9 @@ +function binary_search(array, value, left, right, middle) { + while (left <= right) { + middle = int((right + left) / 2) + if (value == array[middle]) return 1 + if (value < array[middle]) right = middle - 1 + else left = middle + 1 + } + return 0 +} diff --git a/Task/Binary_search/AWK/binary_search.awk b/Task/Binary_search/AWK/binary_search.awk new file mode 100644 index 0000000000..a8634e719e --- /dev/null +++ b/Task/Binary_search/AWK/binary_search.awk @@ -0,0 +1,8 @@ +function binary_search(array, value, left, right, middle) { + if (right < left) return 0 + middle = int((right + left) / 2) + if (value == array[middle]) return 1 + if (value < array[middle]) + return binary_search(array, value, left, middle - 1) + return binary_search(array, value, middle + 1, right) +} diff --git a/Task/Binary_search/BASIC/binary_search-2.bas b/Task/Binary_search/BASIC/binary_search-2.bas new file mode 100644 index 0000000000..357c24f623 --- /dev/null +++ b/Task/Binary_search/BASIC/binary_search-2.bas @@ -0,0 +1,17 @@ +FUNCTION binary_search ( array() AS Integer, value AS Integer, lo AS Integer, hi AS Integer) AS Integer + DIM middle AS Integer + + WHILE lo <= hi + middle = (hi + lo) / 2 + SELECT CASE value + CASE IS < array(middle) + hi = middle - 1 + CASE IS > array(middle) + lo = middle + 1 + CASE ELSE + binary_search = middle + EXIT FUNCTION + END SELECT + WEND + binary_search = 0 +END FUNCTION diff --git a/Task/Binary_search/BASIC/binary_search-3.bas b/Task/Binary_search/BASIC/binary_search-3.bas new file mode 100644 index 0000000000..5f8102ec31 --- /dev/null +++ b/Task/Binary_search/BASIC/binary_search-3.bas @@ -0,0 +1,23 @@ +SUB search (array() AS Integer, value AS Integer) + DIM idx AS Integer + + idx = binary_search(array(), value, LBOUND(array), UBOUND(array)) + PRINT "Value "; value; + IF idx < 1 THEN + PRINT " not found" + ELSE + PRINT " found at index "; idx + END IF +END SUB + +DIM test(1 TO 10) AS Integer +DIM i AS Integer + +DATA 2, 3, 5, 6, 8, 10, 11, 15, 19, 20 +FOR i = 1 TO 10 ' Fill the test array + READ test(i) +NEXT i + +search test(), 4 +search test(), 8 +search test(), 20 diff --git a/Task/Binary_search/BASIC/binary_search.bas b/Task/Binary_search/BASIC/binary_search.bas new file mode 100644 index 0000000000..2d297a2078 --- /dev/null +++ b/Task/Binary_search/BASIC/binary_search.bas @@ -0,0 +1,17 @@ +FUNCTION binary_search ( array() AS Integer, value AS Integer, lo AS Integer, hi AS Integer) AS Integer + DIM middle AS Integer + + IF hi < lo THEN + binary_search = 0 + ELSE + middle = (hi + lo) / 2 + SELECT CASE value + CASE IS < array(middle) + binary_search = binary_search(array(), value, lo, middle-1) + CASE IS > array(middle) + binary_search = binary_search(array(), value, middle+1, hi) + CASE ELSE + binary_search = middle + END SELECT + END IF +END FUNCTION diff --git a/Task/Binary_search/C/binary_search-2.c b/Task/Binary_search/C/binary_search-2.c new file mode 100644 index 0000000000..0a92817172 --- /dev/null +++ b/Task/Binary_search/C/binary_search-2.c @@ -0,0 +1,38 @@ +#define DUMMY -1 /* dummy element of array (to adjust indexing from 1..n) */ + +int main(void) +{ + Object a[] = {DUMMY, 0, 1, 1, 2, 5}; /* allowed indices from 1 to n including */ + int n = sizeof(a)/sizeof(*a) - 1; + const int NotFound = -1; + + /* key not in Array */ + Object key = 4; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + key = DUMMY; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + key = 7; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + + /* all possible `n' and `k' for `a' array */ + int k; + key = 10; /* not in `a` array */ + for (n = 0; n <= sizeof(a)/sizeof(*a) - 1; ++n) + for (k = n; k>=1; --k) { + int index = bsearch(a, n, &a[k], cmpObject, NotFound); + assert(index == k || (k==3 && index == 2) || n == 0); /* for equal `1's */ + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + } + n = sizeof(a)/sizeof(*a) - 1; + + /* NULL array */ + assert(NotFound == bsearch(NULL, n, &key, cmpObject, NotFound)); + /* NULL &key */ + assert(NotFound == bsearch(a, n, NULL, cmpObject, NotFound)); + /* NULL cmpObject */ + assert(1 == bsearch(a, n, &a[1], cmpObject, NotFound)); + assert(NotFound == bsearch(a, n, &a[1], NULL, NotFound)); + + printf("OK\n"); + return 0; +} diff --git a/Task/Binary_search/C/binary_search-3.c b/Task/Binary_search/C/binary_search-3.c new file mode 100644 index 0000000000..673888784a --- /dev/null +++ b/Task/Binary_search/C/binary_search-3.c @@ -0,0 +1,21 @@ +#include /* for bsearch */ +#include + +int intcmp(const void *a, const void *b) +{ + /* this is only correct if it doesn't overflow */ + return *(const int *)a - *(const int *)b; +} + +int main() +{ + int nums[5] = {2, 3, 5, 6, 8}; + int desired = 6; + int *ptr = bsearch(&desired, nums, 5, sizeof(int), intcmp); + if (ptr == NULL) + printf("not found\n"); + else + printf("index = %d\n", ptr - nums); + + return 0; +} diff --git a/Task/Binary_search/C/binary_search.c b/Task/Binary_search/C/binary_search.c new file mode 100644 index 0000000000..d68f733aaa --- /dev/null +++ b/Task/Binary_search/C/binary_search.c @@ -0,0 +1,36 @@ +/* http://www.solipsys.co.uk/b_search/spec.htm */ +typedef int Object; + +int cmpObject(Object* pa, Object *pb) +{ + Object a = *pa; + Object b = *pb; + if (a < b) return -1; + if (a == b) return 0; + if (a > b) return 1; + assert(0); +} + +int bsearch(Object Array[], int n, Object *KeyPtr, + int (*cmp)(Object *, Object *), + int NotFound) +{ + unsigned left = 1, right = n; /* `unsigned' to avoid overflow in `(left + right)/2' */ + + if ( ! (Array && n > 0 && KeyPtr && cmp)) + return NotFound; /* invalid input or empty array */ + + while (left < right) + { + /* invariant: a[left] <= *KeyPtr <= a[right] or *KeyPtr not in Array */ + unsigned m = (left + right) / 2; /*NOTE: *intentionally* truncate for odd sum */ + + if (cmp(Array + m, KeyPtr) < 0) + left = m + 1; /* a[m] < *KeyPtr <= a[right] or *KeyPtr not in Array */ + else + /* assert(right != m) or infinite loop possible */ + right = m; /* a[left] <= *KeyPtr <= a[m] or *KeyPtr not in Array */ + } + /* assert(left == right) */ + return (cmp(Array + right, KeyPtr) == 0) ? right : NotFound; +} diff --git a/Task/Binary_search/Clojure/binary_search.clj b/Task/Binary_search/Clojure/binary_search.clj new file mode 100644 index 0000000000..9da2d9e9c8 --- /dev/null +++ b/Task/Binary_search/Clojure/binary_search.clj @@ -0,0 +1,16 @@ +(defn bsearch + ([coll t] + (bsearch coll 0 (dec (count coll)) t)) + ([coll l u t] + (if (> l u) -1 + (let [m (quot (+ l u) 2) mth (nth coll m)] + (cond + ; the middle element is greater than t + ; so search the lower half + (> mth t) (recur coll l (dec m) t) + ; the middle element is less than t + ; so search the upper half + (< mth t) (recur coll (inc m) u t) + ; we've found our target + ; so return its index + (= mth t) m))))) diff --git a/Task/Binary_search/CoffeeScript/binary_search.coffee b/Task/Binary_search/CoffeeScript/binary_search.coffee new file mode 100644 index 0000000000..b78af45ce3 --- /dev/null +++ b/Task/Binary_search/CoffeeScript/binary_search.coffee @@ -0,0 +1,16 @@ +binsearch = (arr, k) -> + low = 0 + high = arr.length - 1 + while low <= high + mid = Math.floor (low + high) / 2 + return mid if arr[mid] == k + if arr[mid] < k + low = mid + 1 + else + high = mid - 1 + null + +arr = [1,3,5,7,9,11] +for i in [0..12] + pos = binsearch arr, i + console.log "found #{i} at pos #{pos}" if pos? diff --git a/Task/Binary_search/Erlang/binary_search.erl b/Task/Binary_search/Erlang/binary_search.erl new file mode 100644 index 0000000000..5a086c5ce9 --- /dev/null +++ b/Task/Binary_search/Erlang/binary_search.erl @@ -0,0 +1,27 @@ +%% Task: Binary Search algorithm +%% Author: Abhay Jain + +-module(searching_algorithm). +-export([start/0]). + +start() -> + List = [1,2,3], + binary_search(List, 5, 1, length(List)). + + +binary_search(List, Value, Low, High) -> + if Low > High -> + io:format("Number ~p not found~n", [Value]), + not_found; + true -> + Mid = (Low + High) div 2, + MidNum = lists:nth(Mid, List), + if MidNum > Value -> + binary_search(List, Value, Low, Mid-1); + MidNum < Value -> + binary_search(List, Value, Mid+1, High); + true -> + io:format("Number ~p found at index ~p", [Value, Mid]), + Mid + end + end. diff --git a/Task/Binary_search/Forth/binary_search.fth b/Task/Binary_search/Forth/binary_search.fth new file mode 100644 index 0000000000..a16fe79e63 --- /dev/null +++ b/Task/Binary_search/Forth/binary_search.fth @@ -0,0 +1,31 @@ +defer (compare) +' - is (compare) \ default to numbers + +: cstr-compare ( cstr1 cstr2 -- <=> ) \ counted strings + swap count rot count compare ; + +: mid ( u l -- mid ) tuck - 2/ -cell and + ; + +: bsearch ( item upper lower -- where found? ) + rot >r + begin 2dup > + while 2dup mid + dup @ r@ (compare) + dup + while 0< + if nip cell+ ( upper mid+1 ) + else rot drop swap ( mid lower ) + then + repeat drop nip nip true + else max ( insertion-point ) false + then + r> drop ; + +create test 2 , 4 , 6 , 9 , 11 , 99 , +: probe ( n -- ) test 5 cells bounds bsearch . @ . cr ; +1 probe \ 0 2 +2 probe \ -1 2 +3 probe \ 0 4 +10 probe \ 0 11 +11 probe \ -1 11 +12 probe \ 0 99 diff --git a/Task/Binary_search/Fortran/binary_search-2.f b/Task/Binary_search/Fortran/binary_search-2.f new file mode 100644 index 0000000000..8f741a0a47 --- /dev/null +++ b/Task/Binary_search/Fortran/binary_search-2.f @@ -0,0 +1,23 @@ +function binarySearch_I (a, value) + integer :: binarySearch_I + real, intent(in), target :: a(:) + real, intent(in) :: value + real, pointer :: p(:) + integer :: mid, offset + + p => a + binarySearch_I = 0 + offset = 0 + do while (size(p) > 0) + mid = size(p)/2 + 1 + if (p(mid) > value) then + p => p(:mid-1) + else if (p(mid) < value) then + offset = offset + mid + p => p(mid+1:) + else + binarySearch_I = offset + mid ! SUCCESS!! + return + end if + end do +end function binarySearch_I diff --git a/Task/Binary_search/Fortran/binary_search.f b/Task/Binary_search/Fortran/binary_search.f new file mode 100644 index 0000000000..543a1f53b7 --- /dev/null +++ b/Task/Binary_search/Fortran/binary_search.f @@ -0,0 +1,18 @@ +recursive function binarySearch_R (a, value) result (bsresult) + real, intent(in) :: a(:), value + integer :: bsresult, mid + + mid = size(a)/2 + 1 + if (size(a) == 0) then + bsresult = 0 ! not found + else if (a(mid) > value) then + bsresult= binarySearch_R(a(:mid-1), value) + else if (a(mid) < value) then + bsresult = binarySearch_R(a(mid+1:), value) + if (bsresult /= 0) then + bsresult = mid + bsresult + end if + else + bsresult = mid ! SUCCESS!! + end if +end function binarySearch_R diff --git a/Task/Binary_search/Go/binary_search-2.go b/Task/Binary_search/Go/binary_search-2.go new file mode 100644 index 0000000000..72eecdfbe4 --- /dev/null +++ b/Task/Binary_search/Go/binary_search-2.go @@ -0,0 +1,15 @@ +func binarySearch(a []float64, value float64) int { + low := 0 + high := len(a) - 1 + for low <= high { + mid := (low + high) / 2 + if a[mid] > value { + high = mid - 1 + } else if a[mid] < value { + low = mid + 1 + } else { + return mid + } + } + return -1 +} diff --git a/Task/Binary_search/Go/binary_search-3.go b/Task/Binary_search/Go/binary_search-3.go new file mode 100644 index 0000000000..8ac9166591 --- /dev/null +++ b/Task/Binary_search/Go/binary_search-3.go @@ -0,0 +1,5 @@ +import "sort" + +//... + +sort.SearchInts([]int{0,1,4,5,6,7,8,9}, 6) // evaluates to 4 diff --git a/Task/Binary_search/Go/binary_search.go b/Task/Binary_search/Go/binary_search.go new file mode 100644 index 0000000000..228c200c9b --- /dev/null +++ b/Task/Binary_search/Go/binary_search.go @@ -0,0 +1,12 @@ +func binarySearch(a []float64, value float64, low int, high int) int { + if high < low { + return -1 + } + mid := (low + high) / 2 + if a[mid] > value { + return binarySearch(a, value, low, mid-1) + } else if a[mid] < value { + return binarySearch(a, value, mid+1, high) + } + return mid +} diff --git a/Task/Binary_search/Haskell/binary_search-2.hs b/Task/Binary_search/Haskell/binary_search-2.hs new file mode 100644 index 0000000000..e94148580b --- /dev/null +++ b/Task/Binary_search/Haskell/binary_search-2.hs @@ -0,0 +1,5 @@ +import Data.Array + +binarySearchArray :: (Ix i, Integral i, Ord e) => Array i e -> e -> Maybe i +binarySearchArray a x = binarySearch p (bounds a) where + p m = x `compare` (a ! m) diff --git a/Task/Binary_search/Haskell/binary_search.hs b/Task/Binary_search/Haskell/binary_search.hs new file mode 100644 index 0000000000..32e526faf4 --- /dev/null +++ b/Task/Binary_search/Haskell/binary_search.hs @@ -0,0 +1,9 @@ +binarySearch :: Integral a => (a -> Ordering) -> (a, a) -> Maybe a +binarySearch p (low,high) + | high < low = Nothing + | otherwise = + let mid = (low + high) `div` 2 in + case p mid of + LT -> binarySearch p (low, mid-1) + GT -> binarySearch p (mid+1, high) + EQ -> Just mid diff --git a/Task/Binary_search/Java/binary_search-2.java b/Task/Binary_search/Java/binary_search-2.java new file mode 100644 index 0000000000..5cc5eb0dce --- /dev/null +++ b/Task/Binary_search/Java/binary_search-2.java @@ -0,0 +1,21 @@ +public static void main(String[] args){ + int[] searchMe; + int someNumber; + ... + int index = binarySearch(searchMe, someNumber, 0, searchMe.length); + System.out.println(someNumber + ((index == -1) ? " is not in the array" : (" is at index " + index))); + ... +} + +public static int binarySearch(int[] nums, int check, int lo, int hi){ + if(hi < lo){ + return -1; //impossible index for "not found" + } + int guess = (hi + lo) / 2; + if(nums[guess] > check){ + return binarySearch(nums, check, lo, guess - 1); + }else if(nums[guess]= lo){ + guess = lo + ((hi - lo) / 2); + if(nums[guess] > check){ + hi = guess - 1; + }else if(nums[guess] < check){ + lo = guess + 1; + }else{ + return guess; + } + } + return -1; +} + +public static void main(String[] args){ + int[] searchMe; + int someNumber; + ... + int index = binarySearch(searchMe, someNumber); + System.out.println(someNumber + ((index == -1) ? " is not in the array" : (" is at index " + index))); + ... +} diff --git a/Task/Binary_search/JavaScript/binary_search-2.js b/Task/Binary_search/JavaScript/binary_search-2.js new file mode 100644 index 0000000000..b2ba949fff --- /dev/null +++ b/Task/Binary_search/JavaScript/binary_search-2.js @@ -0,0 +1,14 @@ +function binary_search_iterative(a, value) { + lo = 0; + hi = a.length - 1; + while (lo <= hi) { + var mid = Math.floor((lo+hi)/2); + if (a[mid] > value) + hi = mid - 1; + else if (a[mid] < value) + lo = mid + 1; + else + return mid; + } + return null; +} diff --git a/Task/Binary_search/JavaScript/binary_search.js b/Task/Binary_search/JavaScript/binary_search.js new file mode 100644 index 0000000000..9db7dd951f --- /dev/null +++ b/Task/Binary_search/JavaScript/binary_search.js @@ -0,0 +1,11 @@ +function binary_search_recursive(a, value, lo, hi) { + if (hi < lo) + return null; + var mid = Math.floor((lo+hi)/2); + if (a[mid] > value) + return binary_search_recursive(a, value, lo, mid-1); + else if (a[mid] < value) + return binary_search_recursive(a, value, mid+1, hi); + else + return mid; +} diff --git a/Task/Binary_search/Lua/binary_search-2.lua b/Task/Binary_search/Lua/binary_search-2.lua new file mode 100644 index 0000000000..5e57d23c09 --- /dev/null +++ b/Task/Binary_search/Lua/binary_search-2.lua @@ -0,0 +1,9 @@ +function binarySearch (list, value) + local function search(low, high) + local mid = math.floor((low+high)/2) + if list[mid] > value then return search(low,mid-1) end + if list[mid] < value then return search(mid+1,high) end + return mid + end + return search(1,#list) +end diff --git a/Task/Binary_search/Lua/binary_search.lua b/Task/Binary_search/Lua/binary_search.lua new file mode 100644 index 0000000000..a47e98803b --- /dev/null +++ b/Task/Binary_search/Lua/binary_search.lua @@ -0,0 +1,14 @@ +function binarySearch (list,value) + local low = 1 + local high = #list + local mid = 0 + while low <= high do + mid = math.floor((low+high)/2) + if list[mid] > value then high = mid - 1 + else if list[mid] < value then low = mid + 1 + else return mid + end + end + end + return false +end diff --git a/Task/Binary_search/PHP/binary_search-2.php b/Task/Binary_search/PHP/binary_search-2.php new file mode 100644 index 0000000000..88158badc2 --- /dev/null +++ b/Task/Binary_search/PHP/binary_search-2.php @@ -0,0 +1,15 @@ +function binary_search( $array, $secret, $start, $end ) +{ + $guess = (int)($start + ( ( $end - $start ) / 2 )); + + if ( $end < $start) + return -1; + + if ( $array[$guess] > $secret ) + return (binary_search( $array, $secret, $start, $guess )); + + if ( $array[$guess] < $secret ) + return (binary_search( $array, $secret, $guess, $end ) ); + + return $guess; +} diff --git a/Task/Binary_search/PHP/binary_search.php b/Task/Binary_search/PHP/binary_search.php new file mode 100644 index 0000000000..d5478c2c29 --- /dev/null +++ b/Task/Binary_search/PHP/binary_search.php @@ -0,0 +1,19 @@ +function binary_search( $array, $secret, $start, $end ) +{ + do + { + $guess = (int)($start + ( ( $end - $start ) / 2 )); + + if ( $array[$guess] > $secret ) + $end = $guess; + + if ( $array[$guess] < $secret ) + $start = $guess; + + if ( $end < $start) + return -1; + + } while ( $array[$guess] != $secret ); + + return $guess; +} diff --git a/Task/Binary_search/Perl/binary_search-2.pl b/Task/Binary_search/Perl/binary_search-2.pl new file mode 100644 index 0000000000..230f4bb380 --- /dev/null +++ b/Task/Binary_search/Perl/binary_search-2.pl @@ -0,0 +1,15 @@ +sub binary_search { + ($array_ref, $value, $left, $right) = @_; + if ($right < $left) { + return 0; + } + $middle = ($right + $left) / 2; + if ($array_ref->[$middle] == $value) { + return 1; + } + if ($value < $array_ref->[$middle]) { + binary_search($array_ref, $value, $left, $middle - 1); + } else { + binary_search($array_ref, $value, $middle + 1, $right); + } +} diff --git a/Task/Binary_search/Perl/binary_search.pl b/Task/Binary_search/Perl/binary_search.pl new file mode 100644 index 0000000000..037b86103d --- /dev/null +++ b/Task/Binary_search/Perl/binary_search.pl @@ -0,0 +1,15 @@ +sub binary_search { + ($array_ref, $value, $left, $right) = @_; + while ($left <= $right) { + $middle = ($right + $left) / 2; + if ($array_ref->[$middle] == $value) { + return 1; + } + if ($value < $array_ref->[$middle]) { + $right = $middle - 1; + } else { + $left = $middle + 1; + } + } + return 0; +} diff --git a/Task/Binary_search/PicoLisp/binary_search-2.l b/Task/Binary_search/PicoLisp/binary_search-2.l new file mode 100644 index 0000000000..21fbd00055 --- /dev/null +++ b/Task/Binary_search/PicoLisp/binary_search-2.l @@ -0,0 +1,11 @@ +(de iterativeSearch (Val Lst Len) + (use (N L) + (loop + (T (=0 Len)) + (setq + N (inc (/ Len 2)) + L (nth Lst N) ) + (T (= Val (car L)) Val) + (if (> Val (car L)) + (setq Lst (cdr L) Len (- Len N)) + (setq Len (dec N)) ) ) ) ) diff --git a/Task/Binary_search/PicoLisp/binary_search.l b/Task/Binary_search/PicoLisp/binary_search.l new file mode 100644 index 0000000000..ae715b84b4 --- /dev/null +++ b/Task/Binary_search/PicoLisp/binary_search.l @@ -0,0 +1,8 @@ +(de recursiveSearch (Val Lst Len) + (unless (=0 Len) + (let (N (inc (/ Len 2)) L (nth Lst N)) + (cond + ((= Val (car L)) Val) + ((> Val (car L)) + (recursiveSearch Val (cdr L) (- Len N)) ) + (T (recursiveSearch Val Lst (dec N))) ) ) ) ) diff --git a/Task/Binary_search/Python/binary_search-2.py b/Task/Binary_search/Python/binary_search-2.py new file mode 100644 index 0000000000..c92cd43337 --- /dev/null +++ b/Task/Binary_search/Python/binary_search-2.py @@ -0,0 +1,10 @@ +def binary_search(l, value, low = 0, high = -1): + if not l: return -1 + if(high == -1): high = len(l)-1 + if low == high: + if l[low] == value: return low + else: return -1 + mid = (low+high)//2 + if l[mid] > value: return binary_search(l, value, low, mid-1) + elif l[mid] < value: return binary_search(l, value, mid+1, high) + else: return mid diff --git a/Task/Binary_search/Python/binary_search-3.py b/Task/Binary_search/Python/binary_search-3.py new file mode 100644 index 0000000000..fbf079ee81 --- /dev/null +++ b/Task/Binary_search/Python/binary_search-3.py @@ -0,0 +1,8 @@ +index = bisect.bisect_left(list, item) # leftmost insertion point +index = bisect.bisect_right(list, item) # rightmost insertion point +index = bisect.bisect(list, item) # same as bisect_right + +# same as above but actually insert the item into the list at the given place: +bisect.insort_left(list, item) +bisect.insort_right(list, item) +bisect.insort(list, item) diff --git a/Task/Binary_search/Python/binary_search.py b/Task/Binary_search/Python/binary_search.py new file mode 100644 index 0000000000..f5152151fc --- /dev/null +++ b/Task/Binary_search/Python/binary_search.py @@ -0,0 +1,9 @@ +def binary_search(l, value): + low = 0 + high = len(l)-1 + while low <= high: + mid = (low+high)//2 + if l[mid] > value: high = mid-1 + elif l[mid] < value: low = mid+1 + else: return mid + return -1 diff --git a/Task/Binary_search/R/binary_search-2.r b/Task/Binary_search/R/binary_search-2.r new file mode 100644 index 0000000000..425750fd7f --- /dev/null +++ b/Task/Binary_search/R/binary_search-2.r @@ -0,0 +1,15 @@ +IterBinSearch <- function(A, value) { + low = 1 + high = length(A) + i = 0 + while ( low <= high ) { + mid <- floor((low + high)/2) + if ( A[mid] > value ) + high <- mid - 1 + else if ( A[mid] < value ) + low <- mid + 1 + else + return(mid) + } + NULL +} diff --git a/Task/Binary_search/R/binary_search-3.r b/Task/Binary_search/R/binary_search-3.r new file mode 100644 index 0000000000..bca1a195ab --- /dev/null +++ b/Task/Binary_search/R/binary_search-3.r @@ -0,0 +1,4 @@ +a <- 1:100 +IterBinSearch(a, 50) +BinSearch(a, 50, 1, length(a)) # output 50 +IterBinSearch(a, 101) # outputs NULL diff --git a/Task/Binary_search/R/binary_search.r b/Task/Binary_search/R/binary_search.r new file mode 100644 index 0000000000..899577a219 --- /dev/null +++ b/Task/Binary_search/R/binary_search.r @@ -0,0 +1,13 @@ +BinSearch <- function(A, value, low, high) { + if ( high < low ) { + return(NULL) + } else { + mid <- floor((low + high) / 2) + if ( A[mid] > value ) + BinSearch(A, value, low, mid-1) + else if ( A[mid] < value ) + BinSearch(A, value, mid+1, high) + else + mid + } +} diff --git a/Task/Binary_search/REXX/binary_search-2.rexx b/Task/Binary_search/REXX/binary_search-2.rexx new file mode 100644 index 0000000000..0d257886d4 --- /dev/null +++ b/Task/Binary_search/REXX/binary_search-2.rexx @@ -0,0 +1,31 @@ +/*REXX program finds a value in a list using an iterative binary search.*/ +@=' 3 7 13 19 23 31 43 47 61 73 83 89 103 109 113 131', + '139 151 167 181 193 199 229 233 241 271 283 293 313 317 337 349', + '353 359 383 389 401 409 421 433 443 449 463 467 491 503 509 523', + '547 571 577 601 619 643 647 661 677 683 691 709 743 761 773 797', + '811 823 829 839 859 863 883 887 911 919 941 953 971 983 1013' + /*(above) list of weak primes. */ + +parse arg ? . /*get a number the user specified*/ + +if ?=='' then do + say; say '*** error! *** no arg specified.'; say + exit 13 + end + low = 1 +high = words(@) +say 'arithmetic mean of the' high "values=" (word(@,1)+word(@,high))/2 +say + do while low<=high; mid=(low+high)%2; y=word(@,mid) + + if ?=y then do + say ? 'is in the list, its index is:' mid + exit /*stick a fork in it, we're done.*/ + end + + if y>? then high=mid-1 + else low=mid+1 + end /*while*/ + +say ? "wasn't found in the list." + /*stick a fork in it, we're done.*/ diff --git a/Task/Binary_search/REXX/binary_search.rexx b/Task/Binary_search/REXX/binary_search.rexx new file mode 100644 index 0000000000..93112a22eb --- /dev/null +++ b/Task/Binary_search/REXX/binary_search.rexx @@ -0,0 +1,34 @@ +/*REXX program finds a value in a list using a recursive binary search. */ +@=' 11 17 29 37 41 59 67 71 79 97 101 107 127 137 149', + '163 179 191 197 223 227 239 251 269 277 281 307 311 331 347', + '367 379 397 419 431 439 457 461 479 487 499 521 541 557 569', + '587 599 613 617 631 641 659 673 701 719 727 739 751 757 769', + '787 809 821 827 853 857 877 881 907 929 937 967 991 1009' + /*(above) list of strong primes.*/ + +parse arg ? . /*get a number the user specified*/ +if ?=='' then do + say; say '*** error! *** no arg specified.'; say + exit 13 + end + low = 1 +high = words(@) +avg=(word(@,1)+word(@,high))/2 + loc = binarySearch(low,high) + +if loc==-1 then do + say ? "wasn't found in the list." + exit /*stick a fork in it, we're done.*/ + end + else say ? 'is in the list, its index is:' loc +say +say 'arithmetic mean of the' high "values=" avg +exit /*stick a fork in it, we're done.*/ +/*─────────────────────────────────────BINARYSEARCH subroutine──────────*/ +binarySearch: procedure expose @ ?; parse arg low,high +if high? then return binarySearch(low,mid-1) + return binarySearch(mid+1,high) diff --git a/Task/Binary_search/Racket/binary_search.rkt b/Task/Binary_search/Racket/binary_search.rkt new file mode 100644 index 0000000000..a0f4264016 --- /dev/null +++ b/Task/Binary_search/Racket/binary_search.rkt @@ -0,0 +1,13 @@ +#lang racket +(define (binary-search x v) + ; loop : index index -> index or #f + ; return i s.t. l<=i= l h) #f] + [else (define m (quotient (+ l h) 2)) + (define y (vector-ref v m)) + (cond + [(> y x) (loop l (- m 1))] + [(< y x) (loop (+ m 1) h)] + [else m])])) + (loop 0 (vector-length v))) diff --git a/Task/Binary_search/Ruby/binary_search-2.rb b/Task/Binary_search/Ruby/binary_search-2.rb new file mode 100644 index 0000000000..4b237fe043 --- /dev/null +++ b/Task/Binary_search/Ruby/binary_search-2.rb @@ -0,0 +1,18 @@ +class Array + def binary_search_iterative(val) + low, high = 0, length - 1 + while low <= high + mid = (low + high) / 2 + case + when self[mid] > val then high = mid - 1 + when self[mid] < val then low = mid + 1 + else return mid + end + end + nil + end +end + +ary = [0,1,4,5,6,7,8,9,12,26,45,67,78,90,98,123,211,234,456,769,865,2345,3215,14345,24324] +do_a_binary_search(45, ary, :binary_search_iterative) +do_a_binary_search(42, ary, :binary_search_iterative) diff --git a/Task/Binary_search/Ruby/binary_search.rb b/Task/Binary_search/Ruby/binary_search.rb new file mode 100644 index 0000000000..44153a9b41 --- /dev/null +++ b/Task/Binary_search/Ruby/binary_search.rb @@ -0,0 +1,24 @@ +class Array + def binary_search(val, low=0, high=(length - 1)) + return nil if high < low + mid = (low + high) / 2 + case + when self[mid] > val then binary_search(val, low, mid-1) + when self[mid] < val then binary_search(val, mid+1, high) + else mid + end + end +end + +def do_a_binary_search(val, ary, method) + i = ary.send(method, val) + if i + puts "found #{val} at index #{i}: #{ary[i]}" + else + puts "#{val} not found in array" + end +end + +ary = [0,1,4,5,6,7,8,9,12,26,45,67,78,90,98,123,211,234,456,769,865,2345,3215,14345,24324] +do_a_binary_search(45, ary, :binary_search) +do_a_binary_search(42, ary, :binary_search) diff --git a/Task/Binary_search/Scala/binary_search.scala b/Task/Binary_search/Scala/binary_search.scala new file mode 100644 index 0000000000..c37ebb4fe4 --- /dev/null +++ b/Task/Binary_search/Scala/binary_search.scala @@ -0,0 +1,9 @@ +def binarySearch[A <% Ordered[A]](a: IndexedSeq[A], v: A) = { + def recurse(low: Int, high: Int): Option[Int] = (low + high) / 2 match { + case _ if high < low => None + case mid if a(mid) > v => recurse(low, mid - 1) + case mid if a(mid) < v => recurse(mid + 1, high) + case mid => Some(mid) + } + recurse(0, a.size - 1) +} diff --git a/Task/Binary_search/Scheme/binary_search.ss b/Task/Binary_search/Scheme/binary_search.ss new file mode 100644 index 0000000000..ef2b9fac8d --- /dev/null +++ b/Task/Binary_search/Scheme/binary_search.ss @@ -0,0 +1,11 @@ +(define (binary-search value vector) + (let helper ((low 0) + (high (- (vector-length vector) 1))) + (if (< high low) + #f + (let ((middle (quotient (+ low high) 2))) + (cond ((> (vector-ref vector middle) value) + (helper low (- middle 1))) + ((< (vector-ref vector middle) value) + (helper (+ middle 1) high)) + (else middle)))))) diff --git a/Task/Binary_search/Tcl/binary_search-2.tcl b/Task/Binary_search/Tcl/binary_search-2.tcl new file mode 100644 index 0000000000..0417090760 --- /dev/null +++ b/Task/Binary_search/Tcl/binary_search-2.tcl @@ -0,0 +1,8 @@ +proc binarySearch {lst x} { + set idx [lsearch -sorted -exact $lst $x] + if {$idx == -1} { + puts "element $x not found in list" + } else { + puts "element $x found at index $idx" + } +} diff --git a/Task/Binary_search/Tcl/binary_search.tcl b/Task/Binary_search/Tcl/binary_search.tcl new file mode 100644 index 0000000000..269e6a02a4 --- /dev/null +++ b/Task/Binary_search/Tcl/binary_search.tcl @@ -0,0 +1,25 @@ +proc binSrch {lst x} { + set len [llength $lst] + if {$len == 0} { + return -1 + } else { + set pivotIndex [expr {$len / 2}] + set pivotValue [lindex $lst $pivotIndex] + if {$pivotValue == $x} { + return $pivotIndex + } elseif {$pivotValue < $x} { + set recursive [binSrch [lrange $lst $pivotIndex+1 end] $x] + return [expr {$recursive > -1 ? $recursive + $pivotIndex + 1 : -1}] + } elseif {$pivotValue > $x} { + set recursive [binSrch [lrange $lst 0 $pivotIndex-1] $x] + return [expr {$recursive > -1 ? $recursive : -1}] + } + } +} +proc binary_search {lst x} { + if {[set idx [binSrch $lst $x]] == -1} { + puts "element $x not found in list" + } else { + puts "element $x found at index $idx" + } +} diff --git a/Task/Binary_strings/0DESCRIPTION b/Task/Binary_strings/0DESCRIPTION new file mode 100644 index 0000000000..11a69294bb --- /dev/null +++ b/Task/Binary_strings/0DESCRIPTION @@ -0,0 +1,14 @@ +Many languages have powerful and useful ('''binary safe''') [[wp:String (computer science)|string]] [[wp:Comparison of programming languages (string functions)|manipulation functions]], while others don't, making it harder for these languages to accomplish some tasks. +This task is about creating functions to handle ''binary'' strings (strings made of arbitrary bytes, i.e. ''byte strings'' according to Wikipedia) for those languages that don't have built-in support for them. If your language of choice does have this built-in support, show a possible alternative implementation for the ''functions'' or ''abilities'' already provided by the language. +In particular the functions you need to create are: +* String creation and destruction (when needed and if there's no [[garbage collection]] or similar mechanism) +* String assignment +* String comparison +* String cloning and copying +* Check if a string is empty +* Append a byte to a string +* Extract a substring from a string +* Replace every occurrence of a byte (or a string) in a string with another string +* Join strings + +Possible contexts of use: compression algorithms (like [[LZW compression]]), L-systems (manipulation of symbols), many more. diff --git a/Task/Binary_strings/1META.yaml b/Task/Binary_strings/1META.yaml new file mode 100644 index 0000000000..ae625822b7 --- /dev/null +++ b/Task/Binary_strings/1META.yaml @@ -0,0 +1,2 @@ +--- +note: String manipulation diff --git a/Task/Binary_strings/BASIC/binary_strings.bas b/Task/Binary_strings/BASIC/binary_strings.bas new file mode 100644 index 0000000000..d3c3fe1ecf --- /dev/null +++ b/Task/Binary_strings/BASIC/binary_strings.bas @@ -0,0 +1,13 @@ +10 REM create two strings +20 LET s$ = "Hello" +30 LET t$ = "Bob" +40 REM choose any random character +50 LET c = INT(RND*256) +60 REM add the character to the string +70 LET s$ = s$ + CHR$(c) +80 REM check if the string is empty +90 IF s$ = "" THEN PRINT "String is empty" +100 REM compare two strings +110 IF s$ = t$ THEN PRINT "Strings are the same" +120 REM print characters 2 to 4 of a string (a substring) +130 PRINT s$(2 TO 4) diff --git a/Task/Binary_strings/C/binary_strings.c b/Task/Binary_strings/C/binary_strings.c new file mode 100644 index 0000000000..5e9f6db1f4 --- /dev/null +++ b/Task/Binary_strings/C/binary_strings.c @@ -0,0 +1,138 @@ +#include +#include +#include + +typedef struct str_t { + size_t len, alloc; + unsigned char *s; +} bstr_t, *bstr; + +#define str_len(s) ((s)->len) +bstr str_new(size_t len) +{ + bstr s = malloc(sizeof(bstr_t)); + if (len < 8) len = 8; + s->alloc = len; + s->s = malloc(len); + s->len = 0; + return s; +} + +void str_extend(bstr s) +{ + size_t ns = s->alloc * 2; + if (ns - s->alloc > 1024) ns = s->alloc + 1024; + s->s = realloc(s->s, ns); + s->alloc = ns; +} + +void str_del(bstr s) +{ + free(s->s), free(s); +} + +int str_cmp(bstr l, bstr r) +{ + int res, len = l->len; + if (len > r->len) len = r->len; + + if ((res = memcmp(l->s, r->s, len))) return res; + return l->len > r->len ? 1 : -1; +} + +bstr str_dup(bstr src) +{ + bstr x = str_new(src->len); + memcpy(x->s, src->s, src->len); + x->len = src->len; + return x; +} + +bstr str_from_chars(const char *t) +{ + if (!t) return str_new(0); + size_t l = strlen(t); + bstr x = str_new(l + 1); + x->len = l; + memcpy(x->s, t, l); + return x; +} + +void str_append(bstr s, unsigned char b) +{ + if (s->len >= s->alloc) str_extend(s); + s->s[s->len++] = b; +} + +bstr str_substr(bstr s, int from, int to) +{ + if (!to) to = s->len; + if (from < 0) from += s->len; + if (from < 0 || from >= s->len) + return 0; + if (to < from) to = from + 1; + bstr x = str_new(to - from); + x->len = to - from; + memcpy(x->s, s->s + from, x->len); + return x; +} + +bstr str_cat(bstr s, bstr s2) +{ + while (s->alloc < s->len + s2->len) str_extend(s); + memcpy(s->s + s->len, s2->s, s2->len); + s->len += s2->len; + return s; +} + +void str_swap(bstr a, bstr b) +{ + size_t tz; + unsigned char *ts; + tz = a->alloc; a->alloc = b->alloc; b->alloc = tz; + tz = a->len; a->len = b->len; b->len = tz; + ts = a->s; a->s = b->s; b->s = ts; +} + +bstr str_subst(bstr tgt, bstr pat, bstr repl) +{ + bstr tmp = str_new(0); + int i; + for (i = 0; i + pat->len <= tgt->len;) { + if (memcmp(tgt->s + i, pat->s, pat->len)) { + str_append(tmp, tgt->s[i]); + i++; + } else { + str_cat(tmp, repl); + i += pat->len; + if (!pat->len) str_append(tmp, tgt->s[i++]); + } + } + while (i < tgt->len) str_append(tmp, tgt->s[i++]); + str_swap(tmp, tgt); + str_del(tmp); + return tgt; +} + +void str_set(bstr dest, bstr src) +{ + while (dest->len < src->len) str_extend(dest); + memcpy(dest->s, src->s, src->len); + dest->len = src->len; +} + +int main() +{ + bstr s = str_from_chars("aaaaHaaaaaFaaaaHa"); + bstr s2 = str_from_chars("___."); + bstr s3 = str_from_chars(""); + + str_subst(s, s3, s2); + printf("%.*s\n", s->len, s->s); + + str_del(s); + str_del(s2); + str_del(s3); + + return 0; +} diff --git a/Task/Binary_strings/Forth/binary_strings-2.fth b/Task/Binary_strings/Forth/binary_strings-2.fth new file mode 100644 index 0000000000..1f13f36649 --- /dev/null +++ b/Task/Binary_strings/Forth/binary_strings-2.fth @@ -0,0 +1,6 @@ +: empty? ( str len -- ? ) nip 0= ; +: +c ( c str len -- ) + c! ; +: replace-bytes ( from to str len -- ) + bounds do + over i c@ = if dup i c! then + loop 2drop ; diff --git a/Task/Binary_strings/Forth/binary_strings.fth b/Task/Binary_strings/Forth/binary_strings.fth new file mode 100644 index 0000000000..e0f90e0512 --- /dev/null +++ b/Task/Binary_strings/Forth/binary_strings.fth @@ -0,0 +1,8 @@ +create cstr1 ," A sample string" +create cstr2 ," another string" +create buf 256 allot + +cstr1 count buf place +s" and " buf +place +cstr2 count buf +place +buf count type \ A sample string and another string diff --git a/Task/Binary_strings/Go/binary_strings.go b/Task/Binary_strings/Go/binary_strings.go new file mode 100644 index 0000000000..921e6fd7d3 --- /dev/null +++ b/Task/Binary_strings/Go/binary_strings.go @@ -0,0 +1,85 @@ +package main + +import ( + "bytes" + "fmt" +) + +// Strings in Go allow arbitrary bytes. They are implemented basically as +// immutable byte slices and syntactic sugar. This program shows functions +// required by the task on byte slices, thus it mostly highlights what +// happens behind the syntactic sugar. The program does not attempt to +// reproduce the immutability property of strings, as that does not seem +// to be the intent of the task. + +func main() { + // Task point: String creation and destruction. + // Strings are most often constructed from literals as in s := "binary" + // With byte slices, + b := []byte{'b', 'i', 'n', 'a', 'r', 'y'} + fmt.Println(b) // output shows numeric form of bytes. + // Go is garbage collected. There are no destruction operations. + + // Task point: String assignment. + // t = s assigns strings. Since strings are immutable, it is irrelevant + // whether the string is copied or not. + // With byte slices, the same works, + var c []byte + c = b + fmt.Println(c) + + // Task point: String comparison. + // operators <, <=, ==, >=, and > work directly on strings comparing them + // by lexicographic order. + // With byte slices, there are standard library functions, bytes.Equal + // and bytes.Compare. + fmt.Println(bytes.Equal(b, c)) // prints true + + // Task point: String cloning and copying. + // The immutable property of Go strings makes cloning and copying + // meaningless for strings. + // With byte slices though, it is relevant. The assignment c = b shown + // above does a reference copy, leaving both c and b based on the same + // underlying data. To clone or copy the underlying data, + d := make([]byte, len(b)) // allocate new space + copy(d, b) // copy the data + // The data can be manipulated independently now: + d[1] = 'a' + d[4] = 'n' + fmt.Println(string(b)) // convert to string for readable output + fmt.Println(string(d)) + + // Task point: Check if a string is empty. + // Most typical for strings is s == "", but len(s) == 0 works too. + // For byte slices, "" does not work, len(b) == 0 is correct. + fmt.Println(len(b) == 0) + + // Task point: Append a byte to a string. + // The language does not provide a way to do this directly with strings. + // Instead, the byte must be converted to a one-byte string first, as in, + // s += string('z') + // For byte slices, the language provides the append function, + z := append(b, 'z') + fmt.Printf("%s\n", z) // another way to get readable output + + // Task point: Extract a substring from a string. + // Slicing syntax is the for both strings and slices. + sub := b[1:3] + fmt.Println(string(sub)) + + // Task point: Replace every occurrence of a byte (or a string) + // in a string with another string. + // Go supports this with similar library functions for strings and + // byte slices. Strings: t = strings.Replace(s, "n", "m", -1). + // The byte slice equivalent returns a modified copy, leaving the + // original byte slice untouched, + f := bytes.Replace(d, []byte{'n'}, []byte{'m'}, -1) + fmt.Printf("%s -> %s\n", d, f) + + // Task point: Join strings. + // Using slicing syntax again, with strings, + // rem := s[:1] + s[3:] leaves rem == "bary". + // Only the concatenation of the parts is different with byte slices, + rem := append(append([]byte{}, b[:1]...), b[3:]...) + fmt.Println(string(rem)) +} diff --git a/Task/Binary_strings/Haskell/binary_strings-2.hs b/Task/Binary_strings/Haskell/binary_strings-2.hs new file mode 100644 index 0000000000..978f8721d9 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-2.hs @@ -0,0 +1,8 @@ +{- Comparing two given strings and +returning a boolean result using a +simple conditional -} +strCompare :: String -> String -> Bool +strCompare x y = + if x == y + then True + else False diff --git a/Task/Binary_strings/Haskell/binary_strings-3.hs b/Task/Binary_strings/Haskell/binary_strings-3.hs new file mode 100644 index 0000000000..a36ffbaeef --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-3.hs @@ -0,0 +1,8 @@ +{- As strings are equivalent to lists +of characters in Haskell, test and +see if the given string is an empty list -} +strIsEmpty :: String -> Bool +strIsEmpty x = + if x == [] + then True + else False diff --git a/Task/Binary_strings/Haskell/binary_strings-4.hs b/Task/Binary_strings/Haskell/binary_strings-4.hs new file mode 100644 index 0000000000..0a50fe3858 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-4.hs @@ -0,0 +1,8 @@ +{- This is the most obvious way to +append strings, using the built-in +(++) concatenation operator +Note the same would work to join +any two strings (as 'variables' or +as typed strings -} +strAppend :: String -> String -> String +strAppend x y = x ++ y diff --git a/Task/Binary_strings/Haskell/binary_strings-5.hs b/Task/Binary_strings/Haskell/binary_strings-5.hs new file mode 100644 index 0000000000..66ba1be2a1 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-5.hs @@ -0,0 +1,4 @@ +{- Take the specified number of characters +from the given string -} +strExtract :: Int -> String -> String +strExtract x s = take x s diff --git a/Task/Binary_strings/Haskell/binary_strings-6.hs b/Task/Binary_strings/Haskell/binary_strings-6.hs new file mode 100644 index 0000000000..bdcc304956 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-6.hs @@ -0,0 +1,4 @@ +{- Take a certain substring, specified by +two integers, from the given string -} +strPull :: Int -> Int -> String -> String +strPull x y s = take (y-x+1) (drop x s) diff --git a/Task/Binary_strings/Haskell/binary_strings-7.hs b/Task/Binary_strings/Haskell/binary_strings-7.hs new file mode 100644 index 0000000000..6fe8b75067 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings-7.hs @@ -0,0 +1,5 @@ +{- Much thanks to brool.com for this nice +and elegant solution. Using an imported standard library +(Text.Regex), replace a given substring with another -} +strReplace :: String -> String -> String -> String +strReplace old new orig = subRegex (mkRegex old) orig new diff --git a/Task/Binary_strings/Haskell/binary_strings.hs b/Task/Binary_strings/Haskell/binary_strings.hs new file mode 100644 index 0000000000..7060dbf032 --- /dev/null +++ b/Task/Binary_strings/Haskell/binary_strings.hs @@ -0,0 +1,9 @@ +import Text.Regex +{- The above import is needed only for the last function. +It is used there purely for readability and conciseness -} + +{- Assigning a string to a 'variable'. +We're being explicit about it just for show. +Haskell would be able to figure out the type +of "world" -} +string = "world" :: String diff --git a/Task/Binary_strings/Lua/binary_strings.lua b/Task/Binary_strings/Lua/binary_strings.lua new file mode 100644 index 0000000000..5609b2b7fe --- /dev/null +++ b/Task/Binary_strings/Lua/binary_strings.lua @@ -0,0 +1,31 @@ +foo = 'foo' -- Ducktyping foo to be string 'foo' +bar = 'bar' +assert (foo == "foo") -- Comparing string var to string literal +assert (foo ~= bar) +str = foo -- Copy foo contents to str +if #str == 0 then -- # operator returns string length + print 'str is empty' +end +str=str..string.char(50)-- Char concatenated with .. operator +substr = str:sub(1,3) -- Extract substring from index 1 to 3, inclusively + +str = "string string string string" +-- This function will replace all occurances of 'replaced' in a string with 'replacement' +function replaceAll(str,replaced,replacement) + local function sub (a,b) + if b > a then + return str:sub(a,b) + end + return nil + end + a,b = str:find(replaced) + while a do + str = str:sub(1,a-1) .. replacement .. str:sub(b+1,#str) + a,b = str:find(replaced) + end + return str +end +str = replaceAll (str, 'ing', 'ong') +print (str) + +str = foo .. bar -- Strings concatenate with .. operator diff --git a/Task/Binary_strings/PicoLisp/binary_strings-2.l b/Task/Binary_strings/PicoLisp/binary_strings-2.l new file mode 100644 index 0000000000..f368302374 --- /dev/null +++ b/Task/Binary_strings/PicoLisp/binary_strings-2.l @@ -0,0 +1,6 @@ +: (hd "rawfile") +00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................ +00000010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................ +00000020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ +00000030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? +... diff --git a/Task/Binary_strings/PicoLisp/binary_strings-3.l b/Task/Binary_strings/PicoLisp/binary_strings-3.l new file mode 100644 index 0000000000..a358687705 --- /dev/null +++ b/Task/Binary_strings/PicoLisp/binary_strings-3.l @@ -0,0 +1,5 @@ +: (in '(dd "skip=32" "bs=1" "count=16" "if=rawfile") + (make + (while (rd 1) + (link @) ) ) ) +-> (32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47) diff --git a/Task/Binary_strings/PicoLisp/binary_strings-4.l b/Task/Binary_strings/PicoLisp/binary_strings-4.l new file mode 100644 index 0000000000..c0eee8ea73 --- /dev/null +++ b/Task/Binary_strings/PicoLisp/binary_strings-4.l @@ -0,0 +1,2 @@ +: (pack (mapcar char (32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47))) +-> " !\"#$%&'()*+,-./" diff --git a/Task/Binary_strings/PicoLisp/binary_strings.l b/Task/Binary_strings/PicoLisp/binary_strings.l new file mode 100644 index 0000000000..211129b314 --- /dev/null +++ b/Task/Binary_strings/PicoLisp/binary_strings.l @@ -0,0 +1,2 @@ +: (out "rawfile" + (mapc wr (range 0 255)) ) diff --git a/Task/Binary_strings/Python/binary_strings-10.py b/Task/Binary_strings/Python/binary_strings-10.py new file mode 100644 index 0000000000..21e0b5ddcd --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-10.py @@ -0,0 +1,5 @@ +items = ["Smith", "John", "417 Evergreen Av", "Chimichurri", "481-3172"] +joined = ",".join(items) +print joined +# output: +# Smith,John,417 Evergreen Av,Chimichurri,481-3172 diff --git a/Task/Binary_strings/Python/binary_strings-11.py b/Task/Binary_strings/Python/binary_strings-11.py new file mode 100644 index 0000000000..287b6e5ede --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-11.py @@ -0,0 +1,5 @@ +line = "Smith,John,417 Evergreen Av,Chimichurri,481-3172" +fields = line.split(',') +print fields +# output: +# ['Smith', 'John', '417 Evergreen Av', 'Chimichurri', '481-3172'] diff --git a/Task/Binary_strings/Python/binary_strings-12.py b/Task/Binary_strings/Python/binary_strings-12.py new file mode 100644 index 0000000000..6d89152ebe --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-12.py @@ -0,0 +1,5 @@ +s1 = b"A 'byte string' literal \n" +s2 = b'You may use any of \' or " as delimiter' +s3 = b"""This text + goes over several lines + up to the closing triple quote""" diff --git a/Task/Binary_strings/Python/binary_strings-13.py b/Task/Binary_strings/Python/binary_strings-13.py new file mode 100644 index 0000000000..edd97127c8 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-13.py @@ -0,0 +1,2 @@ +x = b'abc' +x[0] # evaluates to 97 diff --git a/Task/Binary_strings/Python/binary_strings-14.py b/Task/Binary_strings/Python/binary_strings-14.py new file mode 100644 index 0000000000..6fadc8dd94 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-14.py @@ -0,0 +1,3 @@ +x = b'abc' +list(x) # evaluates to [97, 98, 99] +bytes([97, 98, 99]) # evaluates to b'abc' diff --git a/Task/Binary_strings/Python/binary_strings-2.py b/Task/Binary_strings/Python/binary_strings-2.py new file mode 100644 index 0000000000..83f9c0dee9 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-2.py @@ -0,0 +1,3 @@ +s = "Hello " +t = "world!" +u = s + t # + concatenates diff --git a/Task/Binary_strings/Python/binary_strings-3.py b/Task/Binary_strings/Python/binary_strings-3.py new file mode 100644 index 0000000000..1477ec660b --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-3.py @@ -0,0 +1,4 @@ +assert "Hello" == 'Hello' +assert '\t' == '\x09' +assert "one" < "two" +assert "two" >= "three" diff --git a/Task/Binary_strings/Python/binary_strings-4.py b/Task/Binary_strings/Python/binary_strings-4.py new file mode 100644 index 0000000000..80bec42cc3 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-4.py @@ -0,0 +1,2 @@ +if x=='': print "Empty string" +if not x: print "Empty string, provided you know x is a string" diff --git a/Task/Binary_strings/Python/binary_strings-5.py b/Task/Binary_strings/Python/binary_strings-5.py new file mode 100644 index 0000000000..87cc6303e3 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-5.py @@ -0,0 +1,3 @@ +txt = "Some text" +txt += '\x07' +# txt refers now to a new string having "Some text\x07" diff --git a/Task/Binary_strings/Python/binary_strings-6.py b/Task/Binary_strings/Python/binary_strings-6.py new file mode 100644 index 0000000000..98bf5ea4f6 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-6.py @@ -0,0 +1,6 @@ +txt = "Some more text" +assert txt[4] == " " +assert txt[0:4] == "Some" +assert txt[:4] == "Some" # you can omit the starting index if 0 +assert txt[5:9] == "more" +assert txt[5:] == "more text" # omitting the second index means "to the end" diff --git a/Task/Binary_strings/Python/binary_strings-7.py b/Task/Binary_strings/Python/binary_strings-7.py new file mode 100644 index 0000000000..df5071cb7b --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-7.py @@ -0,0 +1,3 @@ +txt = "Some more text" +assert txt[-1] == "t" +assert txt[-4:] == "text" diff --git a/Task/Binary_strings/Python/binary_strings-8.py b/Task/Binary_strings/Python/binary_strings-8.py new file mode 100644 index 0000000000..f01d02c768 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-8.py @@ -0,0 +1,3 @@ +v1 = "hello world" +v2 = v1.replace("l", "L") +print v2 # prints heLLo worLd diff --git a/Task/Binary_strings/Python/binary_strings-9.py b/Task/Binary_strings/Python/binary_strings-9.py new file mode 100644 index 0000000000..374fce18b3 --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings-9.py @@ -0,0 +1,3 @@ +v1 = "hello" +v2 = "world" +msg = v1 + " " + v2 diff --git a/Task/Binary_strings/Python/binary_strings.py b/Task/Binary_strings/Python/binary_strings.py new file mode 100644 index 0000000000..0d0b94f60c --- /dev/null +++ b/Task/Binary_strings/Python/binary_strings.py @@ -0,0 +1,5 @@ +s1 = "A 'string' literal \n" +s2 = 'You may use any of \' or " as delimiter' +s3 = """This text + goes over several lines + up to the closing triple quote""" diff --git a/Task/Binary_strings/REXX/binary_strings.rexx b/Task/Binary_strings/REXX/binary_strings.rexx new file mode 100644 index 0000000000..1ff00421d4 --- /dev/null +++ b/Task/Binary_strings/REXX/binary_strings.rexx @@ -0,0 +1,31 @@ +/*REXX program shows ways to use and express binary strings. */ + +dingsta='11110101'b /*4 versions, bit str assignment.*/ +dingsta="11110101"b /*same as above. */ +dingsta='11110101'B /*same as above. */ +dingsta='1111 0101'B /*same as above. */ + +dingst2=dingsta /*clone 1 str to another (copy). */ + +other='1001 0101 1111 0111'b /*another binary (bit) string. */ + +if dingsta=other then say 'they are equal' /*compare two strings.*/ + +if other=='' then say 'OTHER is empty.' /*see if it's empty. */ +if length(other)==0 then say 'OTHER is empty.' /*another version. */ + +otherA=other || '$' /*append a dollar sign to OTHER. */ +otherB=other'$' /*same as above, with less fuss. */ + +guts=substr(c2b(other),10,3) /*get the 10th through 12th bits.*/ + /*see sub below. Some REXXes */ + /*have C2B as a built-in function*/ + +new=changestr('A',other,"Z") /*change the letter A to Z. */ + +tt=changestr('~~',other,";") /*change 2 tildes to a semicolon.*/ + +joined=dignsta || dingst2 /*join 2 strs together (concat). */ +exit /*stick a fork in it, we're done.*/ +/*─────────────────────────────────C2B subroutine───────────────────────*/ +c2b: return x2b(c2x(arg(1))) /*return the string as a binary string. */ diff --git a/Task/Binary_strings/Racket/binary_strings.rkt b/Task/Binary_strings/Racket/binary_strings.rkt new file mode 100644 index 0000000000..e63aa9e455 --- /dev/null +++ b/Task/Binary_strings/Racket/binary_strings.rkt @@ -0,0 +1,47 @@ +#lang racket + +;; Byte strings can be created either by a function (b1) +;; or as a literal string (b2). No operation is needed for +;; destruction due to garbage collection. + +(define b1 (make-bytes 5 65)) ; b1 -> #"AAAAA" +(define b2 #"BBBBB") ; b2 -> #"BBBBB" + +;; String assignment. Note that b2 cannot be +;; mutated since literal byte strings are immutable. + +(bytes-set! b1 0 66) ; b1 -> #"BAAAA" + +;; Comparison. Less than & greater than are +;; lexicographic comparison. + +(bytes=? b1 b2) ; -> #f +(bytes #t +(bytes>? b1 b2) ; -> #f + +;; Byte strings can be cloned by copying to a +;; new one or by overwriting an existing one. + +(define b3 (bytes-copy b1)) ; b3 -> #"BAAAA" +(bytes-copy! b1 0 b2) ; b1 -> #"BBBBB" + +;; Byte strings can be appended to one another. A +;; single byte is appended as a length 1 string. + +(bytes-append b1 b2) ; -> #"BBBBBBBBBB" +(bytes-append b3 #"B") ; -> #"BAAAAB" + +;; Substring + +(subbytes b3 0) ; -> #"BAAAA" +(subbytes b3 0 2) ; -> #"BA" + +;; Regular expressions can be used to do replacements +;; in a byte string (or ordinary strings) + +(regexp-replace #"B" b1 #"A") ; -> #"ABBBB" (only the first one) +(regexp-replace* #"B" b1 #"A") ; -> #"AAAAA" + +;; Joining strings + +(bytes-join (list b2 b3) #" ") ; -> #"BBBBB BAAAA" diff --git a/Task/Binary_strings/Ruby/binary_strings.rb b/Task/Binary_strings/Ruby/binary_strings.rb new file mode 100644 index 0000000000..8912bd8ce0 --- /dev/null +++ b/Task/Binary_strings/Ruby/binary_strings.rb @@ -0,0 +1,45 @@ +# string creation +x = "hello world" + +# string destruction +x = nil + +# string assignment with a null byte +x = "a\0b" +x.length # ==> 3 + +# string comparison +if x == "hello" + puts equal +else + puts "not equal" +end +y = 'bc' +if x < y + puts "#{x} is lexicographically less than #{y}" +end + +# string cloning +xx = x.dup +x == xx # true, same length and content +x.equal?(xx) # false, different objects + +# check if empty +if x.empty? + puts "is empty" +end + +# append a byte +x << "\07" + +# substring +xx = x[0..-2] + +# replace bytes +y = "hello world".tr("l", "L") + +# join strings +a = "hel" +b = "lo w" +c = "orld" +d = a + b + c diff --git a/Task/Binary_strings/Tcl/binary_strings.tcl b/Task/Binary_strings/Tcl/binary_strings.tcl new file mode 100644 index 0000000000..1a7da28fe2 --- /dev/null +++ b/Task/Binary_strings/Tcl/binary_strings.tcl @@ -0,0 +1,36 @@ +# string creation +set x "hello world" + +# string destruction +unset x + +# string assignment with a null byte +set x a\0b +string length $x ;# ==> 3 + +# string comparison +if {$x eq "hello"} {puts equal} else {puts "not equal"} +set y bc +if {$x < $y} {puts "$x is lexicographically less than $y"} + +# string copying; cloning happens automatically behind the scenes +set xx $x + +# check if empty +if {$x eq ""} {puts "is empty"} +if {[string length $x] == 0} {puts "is empty"} + +# append a byte +append x \07 + +# substring +set xx [string range $x 0 end-1] + +# replace bytes +set y [string map {l L} "hello world"] + +# join strings +set a "hel" +set b "lo w" +set c "orld" +set d $a$b$c diff --git a/Task/Caesar_cipher/0DESCRIPTION b/Task/Caesar_cipher/0DESCRIPTION new file mode 100644 index 0000000000..a581248144 --- /dev/null +++ b/Task/Caesar_cipher/0DESCRIPTION @@ -0,0 +1,3 @@ +Implement a [[wp:Caesar cipher|Caesar cipher]], both encryption and decryption. The key is an integer from 1 to 25. This cipher rotates the letters of the alphabet (A to Z). The encryption replaces each letter with the 1st to 25th next letter in the alphabet (wrapping Z to A). So key 2 encrypts "HI" to "JK", but key 20 encrypts "HI" to "BC". This simple "monoalphabetic substitution cipher" provides almost no security, because an attacker who has the encrypted message can either use frequency analysis to guess the key, or just try all 25 keys. + +Caesar cipher is identical to [[Vigenère cipher]] with key of length 1. Also, [[Rot-13]] is identical to Caesar cipher with key 13. diff --git a/Task/Caesar_cipher/1META.yaml b/Task/Caesar_cipher/1META.yaml new file mode 100644 index 0000000000..fdbbfe89ad --- /dev/null +++ b/Task/Caesar_cipher/1META.yaml @@ -0,0 +1,2 @@ +--- +note: Encryption diff --git a/Task/Caesar_cipher/AWK/caesar_cipher.awk b/Task/Caesar_cipher/AWK/caesar_cipher.awk new file mode 100644 index 0000000000..e8e60caec4 --- /dev/null +++ b/Task/Caesar_cipher/AWK/caesar_cipher.awk @@ -0,0 +1,42 @@ +#!/usr/bin/awk -f + +BEGIN { + message = "My hovercraft is full of eels." + key = 1 + + cypher = caesarEncode(key, message) + clear = caesarDecode(key, cypher) + + print "message: " message + print " cypher: " cypher + print " clear: " clear + exit +} + +function caesarEncode(key, message) { + return caesarXlat(key, message, "encode") +} + +function caesarDecode(key, message) { + return caesarXlat(key, message, "decode") +} + +function caesarXlat(key, message, dir, plain, cypher, i, num, s) { + plain = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + cypher = substr(plain, key+1) substr(plain, 1, key) + + if (toupper(substr(dir, 1, 1)) == "D") { + s = plain + plain = cypher + cypher = s + } + + s = "" + message = toupper(message) + for (i = 1; i <= length(message); i++) { + num = index(plain, substr(message, i, 1)) + if (num) s = s substr(cypher, num, 1) + else s = s substr(message, i, 1) + } + return s +} diff --git a/Task/Caesar_cipher/C/caesar_cipher.c b/Task/Caesar_cipher/C/caesar_cipher.c new file mode 100644 index 0000000000..d95a2d2fd0 --- /dev/null +++ b/Task/Caesar_cipher/C/caesar_cipher.c @@ -0,0 +1,36 @@ +#include +#include +#include + +#define caesar(x) rot(13, x) +#define decaesar(x) rot(13, x) +#define decrypt_rot(x, y) rot((26-x), y) + +void rot(int c, char *str) +{ + int l = strlen(str); + const char *alpha[2] = { "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + + int i; + for (i = 0; i < l; i++) + { + if (!isalpha(str[i])) + continue; + + str[i] = alpha[isupper(str[i])][((int)(tolower(str[i])-'a')+c)%26]; + } +} + + +int main() +{ + char str[] = "This is a top secret text message!"; + + printf("Original: %s\n", str); + caesar(str); + printf("Encrypted: %s\n", str); + decaesar(str); + printf("Decrypted: %s\n", str); + + return 0; +} diff --git a/Task/Caesar_cipher/Clojure/caesar_cipher.clj b/Task/Caesar_cipher/Clojure/caesar_cipher.clj new file mode 100644 index 0000000000..5a4e9141d6 --- /dev/null +++ b/Task/Caesar_cipher/Clojure/caesar_cipher.clj @@ -0,0 +1,23 @@ +(defn encrypt-character [offset c] + (if (Character/isLetter c) + (let [v (int c) + base (if (>= v (int \a)) + (int \a) + (int \A)) + offset (mod offset 26)] ;works with negative offsets too! + (char (+ (mod (+ (- v base) offset) 26) + base))) + c)) + +(defn encrypt [offset text] + (apply str (map #(encrypt-character offset %) text))) + +(defn decrypt [offset text] + (encrypt (- 26 offset) text)) + + +(let [text "The Quick Brown Fox Jumps Over The Lazy Dog." + enc (encrypt -1 text)] + (print "Original text:" text "\n") + (print "Encryption:" enc "\n") + (print "Decryption:" (decrypt -1 enc) "\n")) diff --git a/Task/Caesar_cipher/CoffeeScript/caesar_cipher.coffee b/Task/Caesar_cipher/CoffeeScript/caesar_cipher.coffee new file mode 100644 index 0000000000..eb4055a3ed --- /dev/null +++ b/Task/Caesar_cipher/CoffeeScript/caesar_cipher.coffee @@ -0,0 +1,10 @@ +cipher = (msg, rot) -> + msg.replace /([a-z|A-Z])/g, ($1) -> + c = $1.charCodeAt(0) + String.fromCharCode \ + if c >= 97 + then (c + rot + 26 - 97) % 26 + 97 + else (c + rot + 26 - 65) % 26 + 65 + +console.log cipher "Hello World", 2 +console.log cipher "azAz %^&*()", 3 diff --git a/Task/Caesar_cipher/Erlang/caesar_cipher-2.erl b/Task/Caesar_cipher/Erlang/caesar_cipher-2.erl new file mode 100644 index 0000000000..177b23de5c --- /dev/null +++ b/Task/Caesar_cipher/Erlang/caesar_cipher-2.erl @@ -0,0 +1 @@ +ceasar:main("The five boxing wizards jump quickly", 3). diff --git a/Task/Caesar_cipher/Erlang/caesar_cipher.erl b/Task/Caesar_cipher/Erlang/caesar_cipher.erl new file mode 100644 index 0000000000..aec82a662b --- /dev/null +++ b/Task/Caesar_cipher/Erlang/caesar_cipher.erl @@ -0,0 +1,33 @@ +%% Ceasar cypher in Erlang for the rosetta code wiki. +%% Implemented by J.W. Luiten + +-module(ceasar). +-export([main/2]). + +%% rot: rotate Char by Key places +rot(Char,Key) when (Char >= $A) and (Char =< $Z) or + (Char >= $a) and (Char =< $z) -> + Offset = $A + Char band 32, + N = Char - Offset, + Offset + (N + Key) rem 26; +rot(Char, _Key) -> + Char. + +%% key: normalize key. +key(Key) when Key < 0 -> + 26 + Key rem 26; +key(Key) when Key > 25 -> + Key rem 26; +key(Key) -> + Key. + +main(PlainText, Key) -> + Encode = key(Key), + Decode = key(-Key), + + io:format("Plaintext ----> ~s~n", [PlainText]), + + CypherText = lists:map(fun(Char) -> rot(Char, Encode) end, PlainText), + io:format("Cyphertext ---> ~s~n", [CypherText]), + + PlainText = lists:map(fun(Char) -> rot(Char, Decode) end, CypherText). diff --git a/Task/Caesar_cipher/Forth/caesar_cipher.fth b/Task/Caesar_cipher/Forth/caesar_cipher.fth new file mode 100644 index 0000000000..e92410572f --- /dev/null +++ b/Task/Caesar_cipher/Forth/caesar_cipher.fth @@ -0,0 +1,19 @@ +: ceasar ( c n -- c ) + over 32 or [char] a - + dup 0 26 within if + over + 25 > if 26 - then + + else 2drop then ; + +: ceasar-string ( n str len -- ) + over + swap do i c@ over ceasar i c! loop drop ; + +: ceasar-inverse ( n -- 'n ) 26 swap - 26 mod ; + +2variable test +s" The five boxing wizards jump quickly!" test 2! + +3 test 2@ ceasar-string +test 2@ cr type + +3 ceasar-inverse test 2@ ceasar-string +test 2@ cr type diff --git a/Task/Caesar_cipher/Fortran/caesar_cipher.f b/Task/Caesar_cipher/Fortran/caesar_cipher.f new file mode 100644 index 0000000000..efb4703dcb --- /dev/null +++ b/Task/Caesar_cipher/Fortran/caesar_cipher.f @@ -0,0 +1,43 @@ +program Caesar_Cipher + implicit none + + integer, parameter :: key = 3 + character(43) :: message = "The five boxing wizards jump quickly" + + write(*, "(2a)") "Original message = ", message + call encrypt(message) + write(*, "(2a)") "Encrypted message = ", message + call decrypt(message) + write(*, "(2a)") "Decrypted message = ", message + +contains + +subroutine encrypt(text) + character(*), intent(inout) :: text + integer :: i + + do i = 1, len(text) + select case(text(i:i)) + case ('A':'Z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 65 + key, 26) + 65) + case ('a':'z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 97 + key, 26) + 97) + end select + end do +end subroutine + +subroutine decrypt(text) + character(*), intent(inout) :: text + integer :: i + + do i = 1, len(text) + select case(text(i:i)) + case ('A':'Z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 65 - key, 26) + 65) + case ('a':'z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 97 - key, 26) + 97) + end select + end do +end subroutine + +end program Caesar_Cipher diff --git a/Task/Caesar_cipher/Go/caesar_cipher-2.go b/Task/Caesar_cipher/Go/caesar_cipher-2.go new file mode 100644 index 0000000000..d1e4263e4c --- /dev/null +++ b/Task/Caesar_cipher/Go/caesar_cipher-2.go @@ -0,0 +1,57 @@ +package main + +import ( + "fmt" + "strings" + "unicode" +) + +type ckey struct { + enc, dec unicode.SpecialCase +} + +func newCaesar(k int) (*ckey, bool) { + if k < 1 || k > 25 { + return nil, false + } + i := uint32(k) + r := rune(k) + return &ckey{ + unicode.SpecialCase{ + {'A', 'Z' - i, [3]rune{r}}, + {'Z' - i + 1, 'Z', [3]rune{r - 26}}, + {'a', 'z' - i, [3]rune{r}}, + {'z' - i + 1, 'z', [3]rune{r - 26}}, + }, + unicode.SpecialCase{ + {'A', 'A' + i - 1, [3]rune{26 - r}}, + {'A' + i, 'Z', [3]rune{-r}}, + {'a', 'a' + i - 1, [3]rune{26 - r}}, + {'a' + i, 'z', [3]rune{-r}}, + }, + }, true +} + +func (ck ckey) encipher(pt string) string { + return strings.ToUpperSpecial(ck.enc, pt) +} + +func (ck ckey) decipher(ct string) string { + return strings.ToUpperSpecial(ck.dec, ct) +} + +func main() { + pt := "The five boxing wizards jump quickly" + fmt.Println("Plaintext:", pt) + for _, key := range []int{0, 1, 7, 25, 26} { + ck, ok := newCaesar(key) + if !ok { + fmt.Println("Key", key, "invalid") + continue + } + ct := ck.encipher(pt) + fmt.Println("Key", key) + fmt.Println(" Enciphered:", ct) + fmt.Println(" Deciphered:", ck.decipher(ct)) + } +} diff --git a/Task/Caesar_cipher/Go/caesar_cipher.go b/Task/Caesar_cipher/Go/caesar_cipher.go new file mode 100644 index 0000000000..8257b42309 --- /dev/null +++ b/Task/Caesar_cipher/Go/caesar_cipher.go @@ -0,0 +1,59 @@ +package main + +import ( + "fmt" + "strings" +) + +type ckey struct { + enc, dec func(rune) rune +} + +func newCaesar(k int) (*ckey, bool) { + if k < 1 || k > 25 { + return nil, false + } + rk := rune(k) + return &ckey{ + enc: func(c rune) rune { + if c >= 'a' && c <= 'z'-rk || c >= 'A' && c <= 'Z'-rk { + return c + rk + } else if c > 'z'-rk && c <= 'z' || c > 'Z'-rk && c <= 'Z' { + return c + rk - 26 + } + return c + }, + dec: func(c rune) rune { + if c >= 'a'+rk && c <= 'z' || c >= 'A'+rk && c <= 'Z' { + return c - rk + } else if c >= 'a' && c < 'a'+rk || c >= 'A' && c < 'A'+rk { + return c - rk + 26 + } + return c + }, + }, true +} + +func (ck ckey) encipher(pt string) string { + return strings.Map(ck.enc, pt) +} + +func (ck ckey) decipher(ct string) string { + return strings.Map(ck.dec, ct) +} + +func main() { + pt := "The five boxing wizards jump quickly" + fmt.Println("Plaintext:", pt) + for _, key := range []int{0, 1, 7, 25, 26} { + ck, ok := newCaesar(key) + if !ok { + fmt.Println("Key", key, "invalid") + continue + } + ct := ck.encipher(pt) + fmt.Println("Key", key) + fmt.Println(" Enciphered:", ct) + fmt.Println(" Deciphered:", ck.decipher(ct)) + } +} diff --git a/Task/Caesar_cipher/Haskell/caesar_cipher.hs b/Task/Caesar_cipher/Haskell/caesar_cipher.hs new file mode 100644 index 0000000000..0cfb674c4c --- /dev/null +++ b/Task/Caesar_cipher/Haskell/caesar_cipher.hs @@ -0,0 +1,17 @@ +import Data.Char (ord, chr) +import Data.Ix (inRange) + +caesar :: Int -> String -> String +caesar k = map f + where + f c + | inRange ('a','z') c = tr 'a' k c + | inRange ('A','Z') c = tr 'A' k c + | otherwise = c + +unCaesar :: Int -> String -> String +unCaesar k = caesar (-k) + +-- char addition +tr :: Char -> Int -> Char -> Char +tr base offset char = chr $ ord base + (ord char - ord base + offset) `mod` 26 diff --git a/Task/Caesar_cipher/Java/caesar_cipher.java b/Task/Caesar_cipher/Java/caesar_cipher.java new file mode 100644 index 0000000000..dc6deb920e --- /dev/null +++ b/Task/Caesar_cipher/Java/caesar_cipher.java @@ -0,0 +1,26 @@ +public class Cipher { + public static void main(String[] args) { + String enc = Cipher.encode( + "The quick brown fox Jumped over the lazy Dog", 12); + System.out.println(enc); + System.out.println(Cipher.decode(enc, 12)); + } + + public static String decode(String enc, int offset) { + return encode(enc, -offset); + } + + public static String encode(String enc, int offset) { + offset = offset % 26 + 26; + StringBuilder encoded = new StringBuilder(); + for (char i : enc.toLowerCase().toCharArray()) { + if (Character.isLetter(i)) { + int j = (i - 'a' + offset) % 26; + encoded.append((char) (j + 'a')); + } else { + encoded.append(i); + } + } + return encoded.toString(); + } +} diff --git a/Task/Caesar_cipher/JavaScript/caesar_cipher.js b/Task/Caesar_cipher/JavaScript/caesar_cipher.js new file mode 100644 index 0000000000..f8a6a32ce4 --- /dev/null +++ b/Task/Caesar_cipher/JavaScript/caesar_cipher.js @@ -0,0 +1,24 @@ +Caesar +

+
diff --git a/Task/Caesar_cipher/Lua/caesar_cipher.lua b/Task/Caesar_cipher/Lua/caesar_cipher.lua
new file mode 100644
index 0000000000..517bb19671
--- /dev/null
+++ b/Task/Caesar_cipher/Lua/caesar_cipher.lua
@@ -0,0 +1,30 @@
+local function encrypt(text, key)
+	return text:gsub("%a", function(t)
+			local base = (t:lower() == t and string.byte('a') or string.byte('A'))
+
+			local r = t:byte() - base
+			r = r + key
+			r = r%26 -- works correctly even if r is negative
+			r = r + base
+			return string.char(r)
+		end)
+end
+
+local function decrypt(text, key)
+	return encrypt(text, -key)
+end
+
+caesar = {
+	encrypt = encrypt,
+	decrypt = decrypt,
+}
+
+-- test
+do
+	local text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
+	local encrypted = caesar.encrypt(text, 7)
+	local decrypted = caesar.decrypt(encrypted, 7)
+	print("Original text:  ", text)
+	print("Encrypted text: ", encrypted)
+	print("Decrypted text: ", decrypted)
+end
diff --git a/Task/Caesar_cipher/PHP/caesar_cipher.php b/Task/Caesar_cipher/PHP/caesar_cipher.php
new file mode 100644
index 0000000000..b087101643
--- /dev/null
+++ b/Task/Caesar_cipher/PHP/caesar_cipher.php
@@ -0,0 +1,19 @@
+= $ascii_a && $char <= $ascii_z ){
+            $char = ( ( $key + $char - $ascii_a ) % 26 ) + $ascii_a;
+        }
+        $plaintext = substr( $plaintext, 1 );
+        $ciphertext .= chr( $char );
+    }
+    return $ciphertext;
+}
+
+echo caesarEncode( "The quick brown fox Jumped over the lazy Dog", 12 ), "\n";
+?>
diff --git a/Task/Caesar_cipher/Perl/caesar_cipher.pl b/Task/Caesar_cipher/Perl/caesar_cipher.pl
new file mode 100644
index 0000000000..95d5e5a41e
--- /dev/null
+++ b/Task/Caesar_cipher/Perl/caesar_cipher.pl
@@ -0,0 +1,11 @@
+sub encipher {
+        my ($_, $k, $decode) = @_;
+        $k = 26 - $k if $decode;
+        join('', map(chr(((ord(uc $_) - 65 + $k) % 26) + 65), /([a-z])/gi));
+}
+
+my $msg = 'THE FIVE BOXING WIZARDS JUMP QUICKLY';
+my $enc = encipher($msg, 10);
+my $dec = encipher($enc, 10, 'decode');
+
+print "msg: $msg\nenc: $enc\ndec: $dec\n";
diff --git a/Task/Caesar_cipher/PicoLisp/caesar_cipher.l b/Task/Caesar_cipher/PicoLisp/caesar_cipher.l
new file mode 100644
index 0000000000..cebce25396
--- /dev/null
+++ b/Task/Caesar_cipher/PicoLisp/caesar_cipher.l
@@ -0,0 +1,6 @@
+(setq *Letters (apply circ (mapcar char (range 65 90))))
+
+(de caesar (Str Key)
+   (pack
+      (mapcar '((C) (cadr (nth (member C *Letters) Key)))
+         (chop (uppc Str)) ) ) )
diff --git a/Task/Caesar_cipher/Prolog/caesar_cipher.pro b/Task/Caesar_cipher/Prolog/caesar_cipher.pro
new file mode 100644
index 0000000000..bf0e31a910
--- /dev/null
+++ b/Task/Caesar_cipher/Prolog/caesar_cipher.pro
@@ -0,0 +1,33 @@
+:- use_module(library(clpfd)).
+
+caesar :-
+	L1 = "The five boxing wizards jump quickly",
+	writef("Original : %s\n", [L1]),
+
+	% encryption of the sentence
+	encoding(3, L1, L2) ,
+	writef("Encoding : %s\n", [L2]),
+
+	% deciphering on the encoded sentence
+	encoding(3, L3, L2),
+	writef("Decoding : %s\n", [L3]).
+
+% encoding/decoding of a sentence
+encoding(Key, L1, L2) :-
+	maplist(caesar_cipher(Key), L1, L2).
+
+caesar_cipher(_, 32, 32) :- !.
+
+caesar_cipher(Key, V1, V2) :-
+	V #= Key + V1,
+
+	% we verify that we are in the limits of A-Z and a-z.
+	((V1 #=< 0'Z #/\ V #> 0'Z) #\/ (V1 #=< 0'z #/\ V #> 0'z)
+	#\/
+	(V1 #< 0'A #/\ V2 #>= 0'A)#\/ (V1 #< 0'a #/\ V2 #>= 0'a)) #==> A,
+
+	% if we are not in these limits A is 1, otherwise 0.
+	V2 #= V - A * 26,
+
+	% compute values of V1 and V2
+	label([A, V1, V2]).
diff --git a/Task/Caesar_cipher/Python/caesar_cipher-2.py b/Task/Caesar_cipher/Python/caesar_cipher-2.py
new file mode 100644
index 0000000000..0f303b448d
--- /dev/null
+++ b/Task/Caesar_cipher/Python/caesar_cipher-2.py
@@ -0,0 +1,15 @@
+import string
+def caesar(s, k, decode = False):
+   if decode: k = 26 - k
+   return s.translate(
+       string.maketrans(
+           string.ascii_uppercase + string.ascii_lowercase,
+           string.ascii_uppercase[k:] + string.ascii_uppercase[:k] +
+           string.ascii_lowercase[k:] + string.ascii_lowercase[:k]
+           )
+       )
+msg = "The quick brown fox jumped over the lazy dogs"
+print msg
+enc = caesar(msg, 11)
+print enc
+print caesar(enc, 11, decode = True)
diff --git a/Task/Caesar_cipher/Python/caesar_cipher-3.py b/Task/Caesar_cipher/Python/caesar_cipher-3.py
new file mode 100644
index 0000000000..838af43dba
--- /dev/null
+++ b/Task/Caesar_cipher/Python/caesar_cipher-3.py
@@ -0,0 +1,9 @@
+from string import ascii_uppercase as abc
+
+def caesar(s, k, decode = False):
+    trans = dict(zip(abc, abc[(k,26-k)[decode]:] + abc[:(k,26-k)[decode]]))
+    return ''.join(trans[L] for L in s.upper() if L in abc)
+
+msg = "The quick brown fox jumped over the lazy dogs"
+print(caesar(msg, 11))
+print(caesar(caesar(msg, 11), 11, True))
diff --git a/Task/Caesar_cipher/Python/caesar_cipher.py b/Task/Caesar_cipher/Python/caesar_cipher.py
new file mode 100644
index 0000000000..975933b38c
--- /dev/null
+++ b/Task/Caesar_cipher/Python/caesar_cipher.py
@@ -0,0 +1,11 @@
+def caesar(s, k, decode = False):
+	if decode: k = 26 - k
+	return "".join([chr((ord(i) - 65 + k) % 26 + 65)
+				for i in s.upper()
+				if ord(i) >= 65 and ord(i) <= 90 ])
+
+msg = "The quick brown fox jumped over the lazy dogs"
+print msg
+enc = caesar(msg, 11)
+print enc
+print caesar(enc, 11, decode = True)
diff --git a/Task/Caesar_cipher/REXX/caesar_cipher-2.rexx b/Task/Caesar_cipher/REXX/caesar_cipher-2.rexx
new file mode 100644
index 0000000000..ae9b656df5
--- /dev/null
+++ b/Task/Caesar_cipher/REXX/caesar_cipher-2.rexx
@@ -0,0 +1,23 @@
+/*REXX pgm: Caesar cypher for almost all keyboard chars including blanks*/
+parse arg key p                        /*get key and text to be cyphered*/
+                        say 'Caesar cypher key:' key
+                        say '       plain text:' p
+y=caesar(p, key)      ; say '         cyphered:' y
+z=caesar(y,-key)      ; say '       uncyphered:' z
+if z\==p then say "plain text doesn't match uncyphered cyphered text."
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────CAESAR subroutine───────────────────*/
+caesar:  procedure;     parse arg s,k;     @='abcdefghijklmnopqrstuvwxyz'
+@=translate(@)@'0123456789(){}[]<>'    /*add uppercase, digs, group symb*/
+@=@'~!@#$%^&*_+:";?,./`-= '''          /*add other characters here.     */
+                       /*last char is doubled, REXX quoted syntax rules.*/
+L=length(@)
+ak=abs(k)
+if ak>length(@)-1 | k==0 then call err k 'key is invalid'
+_=verify(s,@)                          /*any illegal char specified ?   */
+if _\==0 then call err 'unsupported character:' substr(s,_,1)
+if k>0 then ky=k+1
+       else ky=L+1-ak
+return translate(s,substr(@||@,ky,L),@)
+/*──────────────────────────────────ERR subroutine──────────────────────*/
+err:   say;    say '***error!***';    say;    say arg(1);   say;   exit 13
diff --git a/Task/Caesar_cipher/REXX/caesar_cipher.rexx b/Task/Caesar_cipher/REXX/caesar_cipher.rexx
new file mode 100644
index 0000000000..56f910b421
--- /dev/null
+++ b/Task/Caesar_cipher/REXX/caesar_cipher.rexx
@@ -0,0 +1,22 @@
+/*REXX pgm: Caesar cypher: Latin alphabet only, no punctuation or blanks*/
+/*     allowed,  all lowercase Latin letters are treated as uppercase.  */
+arg key p                              /*get key and text to be cyphered*/
+p=space(p,0)                           /*remove all blanks from text.   */
+                        say 'Caesar cypher key:' key
+                        say '       plain text:' p
+y=caesar(p, key)      ; say '         cyphered:' y
+z=caesar(y,-key)      ; say '       uncyphered:' z
+if z\==p then say "plain text doesn't match uncyphered cyphered text."
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────CAESAR subroutine───────────────────*/
+caesar: procedure; arg s,k; @='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; L=length(@)
+ak=abs(k)
+if ak > length(@)-1  |  k==0  |  k==''   then  call err k 'key is invalid'
+_=verify(s,@)                          /*any illegal char specified ?   */
+if _\==0 then call err 'unsupported character:' substr(s,_,1)
+                                       /*now that error checks are done:*/
+if k>0 then ky=k+1                     /*either cypher it, or ...       */
+       else ky=27-ak                   /*     decypher it.              */
+return translate(s,substr(@||@,ky,L),@)
+/*──────────────────────────────────ERR subroutine──────────────────────*/
+err:   say;    say '***error!***';    say;    say arg(1);   say;   exit 13
diff --git a/Task/Caesar_cipher/Racket/caesar_cipher-2.rkt b/Task/Caesar_cipher/Racket/caesar_cipher-2.rkt
new file mode 100644
index 0000000000..3812b82940
--- /dev/null
+++ b/Task/Caesar_cipher/Racket/caesar_cipher-2.rkt
@@ -0,0 +1,5 @@
+> (define s (encrypt "The five boxing wizards jump quickly."))
+> s
+"Uif gjwf cpyjoh xjabset kvnq rvjdlmz."
+> (decrypt s)
+"The five boxing wizards jump quickly."
diff --git a/Task/Caesar_cipher/Racket/caesar_cipher.rkt b/Task/Caesar_cipher/Racket/caesar_cipher.rkt
new file mode 100644
index 0000000000..a51e5c7c08
--- /dev/null
+++ b/Task/Caesar_cipher/Racket/caesar_cipher.rkt
@@ -0,0 +1,19 @@
+#lang racket
+
+(define A (char->integer #\A))
+(define Z (char->integer #\Z))
+(define a (char->integer #\a))
+(define z (char->integer #\z))
+
+(define (rotate c n)
+  (define cnum (char->integer c))
+  (define (shift base) (integer->char (+ base (modulo (+ n (- cnum base)) 26))))
+  (cond [(<= A cnum Z) (shift A)]
+        [(<= a cnum z) (shift a)]
+        [else c]))
+
+(define (caesar s n)
+  (list->string (for/list ([c (in-string s)]) (rotate c n))))
+
+(define (encrypt s) (caesar s 1))
+(define (decrypt s) (caesar s -1))
diff --git a/Task/Caesar_cipher/Ruby/caesar_cipher.rb b/Task/Caesar_cipher/Ruby/caesar_cipher.rb
new file mode 100644
index 0000000000..098532da34
--- /dev/null
+++ b/Task/Caesar_cipher/Ruby/caesar_cipher.rb
@@ -0,0 +1,23 @@
+@atoz = Hash.new do |hash, key|
+  str = ('A'..'Z').to_a.rotate(key).join("")
+  hash[key] = (str << str.downcase)
+end
+
+def encrypt(key, plaintext)
+  (1..25) === key or raise ArgumentError, "key not in 1..25"
+  plaintext.tr(@atoz[0], @atoz[key])
+end
+
+def decrypt(key, ciphertext)
+  (1..25) === key or raise ArgumentError, "key not in 1..25"
+  ciphertext.tr(@atoz[key], @atoz[0])
+end
+
+original = "THEYBROKEOURCIPHEREVERYONECANREADTHIS"
+en = encrypt(3, original)
+de = decrypt(3, en)
+
+[original, en, de].each {|e| puts e}
+
+puts 'OK' if
+  (1..25).all? {|k| original == decrypt(k, encrypt(k, original))}
diff --git a/Task/Caesar_cipher/Scala/caesar_cipher-2.scala b/Task/Caesar_cipher/Scala/caesar_cipher-2.scala
new file mode 100644
index 0000000000..9a87816c9b
--- /dev/null
+++ b/Task/Caesar_cipher/Scala/caesar_cipher-2.scala
@@ -0,0 +1,5 @@
+val text="The five boxing wizards jump quickly"
+println("Plaintext  => " + text)
+val encoded=Caesar.encode(text, 3)
+println("Ciphertext => " + encoded)
+println("Decrypted  => " + Caesar.decode(encoded, 3))
diff --git a/Task/Caesar_cipher/Scala/caesar_cipher.scala b/Task/Caesar_cipher/Scala/caesar_cipher.scala
new file mode 100644
index 0000000000..9980d566a1
--- /dev/null
+++ b/Task/Caesar_cipher/Scala/caesar_cipher.scala
@@ -0,0 +1,12 @@
+object Caesar {
+  private val alphaU='A' to 'Z'
+  private val alphaL='a' to 'z'
+
+  def encode(text:String, key:Int)=text.map{
+    case c if alphaU.contains(c) => rot(alphaU, c, key)
+    case c if alphaL.contains(c) => rot(alphaL, c, key)
+    case c => c
+  }
+  def decode(text:String, key:Int)=encode(text,-key)
+  private def rot(a:IndexedSeq[Char], c:Char, key:Int)=a((c-a.head+key+a.size)%a.size)
+}
diff --git a/Task/Caesar_cipher/Smalltalk/caesar_cipher-2.st b/Task/Caesar_cipher/Smalltalk/caesar_cipher-2.st
new file mode 100644
index 0000000000..aa3657387a
--- /dev/null
+++ b/Task/Caesar_cipher/Smalltalk/caesar_cipher-2.st
@@ -0,0 +1,18 @@
+!CharacterArray methodsFor:'encoding'!
+rot:n
+    ^ self class
+        streamContents:[:aStream |
+            self do:[:char |
+                aStream nextPut:(char rot:n) ]]
+
+
+!Character methodsFor:'encoding'!
+rot:n
+     (self isLetter) ifTrue:[
+        self isLowercase ifTrue:[
+            ^ 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' at:(self-$a+1+n)
+        ] ifFalse:[
+            ^ 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ' at:(self-$A+1+n)
+        ]
+    ].
+    ^ self
diff --git a/Task/Caesar_cipher/Smalltalk/caesar_cipher.st b/Task/Caesar_cipher/Smalltalk/caesar_cipher.st
new file mode 100644
index 0000000000..76df1db2f6
--- /dev/null
+++ b/Task/Caesar_cipher/Smalltalk/caesar_cipher.st
@@ -0,0 +1 @@
+'THE QUICK BROWN FOX' rot:3 -> 'WKH TXLFN EURZQ IRA'
diff --git a/Task/Caesar_cipher/Tcl/caesar_cipher-2.tcl b/Task/Caesar_cipher/Tcl/caesar_cipher-2.tcl
new file mode 100644
index 0000000000..bca315b1f9
--- /dev/null
+++ b/Task/Caesar_cipher/Tcl/caesar_cipher-2.tcl
@@ -0,0 +1,7 @@
+set caesar [Caesar new 3]
+set txt "The five boxing wizards jump quickly."
+set enc [$caesar encrypt $txt]
+set dec [$caesar decrypt $enc]
+puts "Original message  = $txt"
+puts "Encrypted message = $enc"
+puts "Decrypted message = $dec"
diff --git a/Task/Caesar_cipher/Tcl/caesar_cipher.tcl b/Task/Caesar_cipher/Tcl/caesar_cipher.tcl
new file mode 100644
index 0000000000..27c85f38e0
--- /dev/null
+++ b/Task/Caesar_cipher/Tcl/caesar_cipher.tcl
@@ -0,0 +1,23 @@
+package require Tcl 8.6;    # Or TclOO package for 8.5
+
+oo::class create Caesar {
+    variable encryptMap decryptMap
+    constructor shift {
+	for {set i 0} {$i < 26} {incr i} {
+	    # Play fast and loose with string/list duality for shorter code
+	    append encryptMap [format "%c %c %c %c " \
+		    [expr {$i+65}] [expr {($i+$shift)%26+65}] \
+		    [expr {$i+97}] [expr {($i+$shift)%26+97}]]
+	    append decryptMap [format "%c %c %c %c " \
+		    [expr {$i+65}] [expr {($i-$shift)%26+65}] \
+		    [expr {$i+97}] [expr {($i-$shift)%26+97}]]
+	}
+    }
+
+    method encrypt text {
+	string map $encryptMap $text
+    }
+    method decrypt text {
+	string map $decryptMap $text
+    }
+}
diff --git a/Task/Calendar/0DESCRIPTION b/Task/Calendar/0DESCRIPTION
new file mode 100644
index 0000000000..6f458ce65d
--- /dev/null
+++ b/Task/Calendar/0DESCRIPTION
@@ -0,0 +1,15 @@
+Create a routine that will generate a text calendar for any year.  Test the calendar by generating a calendar for the year 1969, on a device of the time. Choose one of the following devices:
+
+* A line printer with a width of 132 characters.
+* An [[wp:IBM_3270#Displays|IBM 3278 model 4 terminal]] (80×43 display with accented characters). Target formatting the months of the year to fit nicely across the 80 character width screen. Restrict number of lines in test output to 43.
+
+(Ideally, the program will generate well-formatted calendars for any page width from 20 characters up.)
+
+Kudos (κῦδος) for routines that also correctly transition from Julian to Gregorian calendar in September 1752.
+
+This task is inspired by [http://www.ee.ryerson.ca/~elf/hack/realmen.html Real Programmers Don't Use PASCAL] by Ed Post, Datamation, volume 29 number 7, July 1983.
+ THE REAL PROGRAMMER'S NATURAL HABITAT
+ "Taped to the wall is a line-printer Snoopy calender for the year 1969."
+For further Kudos see task [[Calendar - for "real" programmers|CALENDAR]], where all code is to be in UPPERCASE.
+
+For economy of size, do not actually include Snoopy generation in either the code or the output, instead just output a place-holder.
diff --git a/Task/Calendar/1META.yaml b/Task/Calendar/1META.yaml
new file mode 100644
index 0000000000..0b8885a678
--- /dev/null
+++ b/Task/Calendar/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Date and time
diff --git a/Task/Calendar/C/calendar.c b/Task/Calendar/C/calendar.c
new file mode 100644
index 0000000000..81a71da6fe
--- /dev/null
+++ b/Task/Calendar/C/calendar.c
@@ -0,0 +1,125 @@
+#include 
+#include 
+#include 
+
+int width = 80, year = 1969;
+int cols, lead, gap;
+
+const char *wdays[] = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
+struct months {
+	const char *name;
+	int days, start_wday, at;
+} months[12] = {
+	{ "January",	31, 0, 0 },
+	{ "Februray",	28, 0, 0 },
+	{ "March",	31, 0, 0 },
+	{ "April",	30, 0, 0 },
+	{ "May",	31, 0, 0 },
+	{ "June",	30, 0, 0 },
+	{ "July",	31, 0, 0 },
+	{ "August",	31, 0, 0 },
+	{ "September",	30, 0, 0 },
+	{ "October",	31, 0, 0 },
+	{ "November",	30, 0, 0 },
+	{ "December",	31, 0, 0 }
+};
+
+void space(int n) { while (n-- > 0) putchar(' '); }
+
+void init_months()
+{
+	int i;
+
+	if ((!(year % 4) && (year % 100)) || !(year % 400))
+		months[1].days = 29;
+
+	year--;
+	months[0].start_wday
+		= (year * 365 + year/4 - year/100 + year/400 + 1) % 7;
+
+	for (i = 1; i < 12; i++)
+		months[i].start_wday =
+			(months[i-1].start_wday + months[i-1].days) % 7;
+
+	cols = (width + 2) / 22;
+	while (12 % cols) cols--;
+	gap = cols - 1 ? (width - 20 * cols) / (cols - 1) : 0;
+	if (gap > 4) gap = 4;
+	lead = (width - (20 + gap) * cols + gap + 1) / 2;
+        year++;
+}
+
+void print_row(int row)
+{
+	int c, i, from = row * cols, to = from + cols;
+	space(lead);
+	for (c = from; c < to; c++) {
+		i = strlen(months[c].name);
+		space((20 - i)/2);
+		printf("%s", months[c].name);
+		space(20 - i - (20 - i)/2 + ((c == to - 1) ? 0 : gap));
+	}
+	putchar('\n');
+
+	space(lead);
+	for (c = from; c < to; c++) {
+		for (i = 0; i < 7; i++)
+			printf("%s%s", wdays[i], i == 6 ? "" : " ");
+		if (c < to - 1) space(gap);
+		else putchar('\n');
+	}
+
+	while (1) {
+		for (c = from; c < to; c++)
+			if (months[c].at < months[c].days) break;
+		if (c == to) break;
+
+		space(lead);
+		for (c = from; c < to; c++) {
+			for (i = 0; i < months[c].start_wday; i++) space(3);
+			while(i++ < 7 && months[c].at < months[c].days) {
+				printf("%2d", ++months[c].at);
+				if (i < 7 || c < to - 1) putchar(' ');
+			}
+			while (i++ <= 7 && c < to - 1) space(3);
+			if (c < to - 1) space(gap - 1);
+			months[c].start_wday = 0;
+		}
+		putchar('\n');
+	}
+	putchar('\n');
+}
+
+void print_year()
+{
+	int row;
+	char buf[32];
+	sprintf(buf, "%d", year);
+	space((width - strlen(buf)) / 2);
+	printf("%s\n\n", buf);
+	for (row = 0; row * cols < 12; row++)
+		print_row(row);
+}
+
+int main(int c, char **v)
+{
+	int i, year_set = 0;
+	for (i = 1; i < c; i++) {
+		if (!strcmp(v[i], "-w")) {
+			if (++i == c || (width = atoi(v[i])) < 20)
+				goto bail;
+		} else if (!year_set) {
+			if (!sscanf(v[i], "%d", &year) || year <= 0)
+				year = 1969;
+			year_set = 1;
+		} else
+			goto bail;
+	}
+
+	init_months();
+	print_year();
+	return 0;
+
+bail:	fprintf(stderr, "bad args\nUsage: %s year [-w width (>= 20)]\n", v[0]);
+	exit(1);
+}
diff --git a/Task/Calendar/Perl/calendar.pl b/Task/Calendar/Perl/calendar.pl
new file mode 100644
index 0000000000..52f47bdced
--- /dev/null
+++ b/Task/Calendar/Perl/calendar.pl
@@ -0,0 +1 @@
+$_=$ARGV[0]//1969;`cal $_ >&2`
diff --git a/Task/Calendar/PicoLisp/calendar.l b/Task/Calendar/PicoLisp/calendar.l
new file mode 100644
index 0000000000..9b5708e760
--- /dev/null
+++ b/Task/Calendar/PicoLisp/calendar.l
@@ -0,0 +1,13 @@
+(de cal (Year)
+   (prinl "====== " Year " ======")
+   (for Dat (range (date Year 1 1) (date Year 12 31))
+      (let D (date Dat)
+         (tab (3 3 4 8)
+            (when (= 1 (caddr D))
+               (get *Mon (cadr D)) )
+            (caddr D)
+            (day Dat *Day)
+            (when (=0 (% (inc Dat) 7))
+               (pack "Week " (week Dat)) ) ) ) ) )
+
+(cal 1969)
diff --git a/Task/Calendar/Python/calendar.py b/Task/Calendar/Python/calendar.py
new file mode 100644
index 0000000000..a302fade9d
--- /dev/null
+++ b/Task/Calendar/Python/calendar.py
@@ -0,0 +1,47 @@
+>>> import calendar
+>>> help(calendar.prcal)
+Help on method pryear in module calendar:
+
+pryear(self, theyear, w=0, l=0, c=6, m=3) method of calendar.TextCalendar instance
+    Print a years calendar.
+
+>>> calendar.prcal(1969)
+                                  1969
+
+      January                   February                   March
+Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
+       1  2  3  4  5                      1  2                      1  2
+ 6  7  8  9 10 11 12       3  4  5  6  7  8  9       3  4  5  6  7  8  9
+13 14 15 16 17 18 19      10 11 12 13 14 15 16      10 11 12 13 14 15 16
+20 21 22 23 24 25 26      17 18 19 20 21 22 23      17 18 19 20 21 22 23
+27 28 29 30 31            24 25 26 27 28            24 25 26 27 28 29 30
+                                                    31
+
+       April                      May                       June
+Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
+    1  2  3  4  5  6                1  2  3  4                         1
+ 7  8  9 10 11 12 13       5  6  7  8  9 10 11       2  3  4  5  6  7  8
+14 15 16 17 18 19 20      12 13 14 15 16 17 18       9 10 11 12 13 14 15
+21 22 23 24 25 26 27      19 20 21 22 23 24 25      16 17 18 19 20 21 22
+28 29 30                  26 27 28 29 30 31         23 24 25 26 27 28 29
+                                                    30
+
+        July                     August                  September
+Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
+    1  2  3  4  5  6                   1  2  3       1  2  3  4  5  6  7
+ 7  8  9 10 11 12 13       4  5  6  7  8  9 10       8  9 10 11 12 13 14
+14 15 16 17 18 19 20      11 12 13 14 15 16 17      15 16 17 18 19 20 21
+21 22 23 24 25 26 27      18 19 20 21 22 23 24      22 23 24 25 26 27 28
+28 29 30 31               25 26 27 28 29 30 31      29 30
+
+      October                   November                  December
+Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
+       1  2  3  4  5                      1  2       1  2  3  4  5  6  7
+ 6  7  8  9 10 11 12       3  4  5  6  7  8  9       8  9 10 11 12 13 14
+13 14 15 16 17 18 19      10 11 12 13 14 15 16      15 16 17 18 19 20 21
+20 21 22 23 24 25 26      17 18 19 20 21 22 23      22 23 24 25 26 27 28
+27 28 29 30 31            24 25 26 27 28 29 30      29 30 31
+
+>>> print('1234567890'*8)
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+>>>
diff --git a/Task/Calendar/REXX/calendar.rexx b/Task/Calendar/REXX/calendar.rexx
new file mode 100644
index 0000000000..5484e582bc
--- /dev/null
+++ b/Task/Calendar/REXX/calendar.rexx
@@ -0,0 +1,145 @@
+/*REXX program to show any year's (monthly) calendar (with/without grid)*/
+
+@abc='abcdefghijklmnopqrstuvwxyz'; @abcU=@abc; upper @abcU
+calfill=' '; mc=12; _='1 3 1234567890' "fb"x
+parse var _ grid calspaces # chk . cv_ days.1 days.2 days.3 daysn sd sw
+_=0; parse var _ cols 1 jd 1 lowerCase 1 maxKalPuts 1 narrow 1,
+                 narrower 1 narrowest 1 short 1 shorter 1 shortest 1,
+                 small 1 smaller 1 smallest 1 upperCase
+parse arg mm '/' dd "/" yyyy _ '(' ops;  uops=ops
+if _\=='' | \is#(mm) | \is#(dd) | \is#(yyyy) then call erx 86
+
+  do while ops\==''; ops=strip(ops,'L'); parse var ops _1 2 1 _ . 1 _o ops
+  upper _
+       select
+       when  abb('CALSPaces')  then calspaces=nai()
+       when  abb('DEPth')      then        sd=nai()
+       when abbn('GRIDs')      then      grid=no()
+       when abbn('LOWercase')  then lowerCase=no()
+       when  abb('CALMONths')  then        mc=nai()
+       when abbn('NARrow')     then    narrow=no()
+       when abbn('NARROWER')   then  narrower=no()
+       when abbn('NARROWESt')  then narrowest=no()
+       when abbn('SHORt')      then     short=no()
+       when abbn('SHORTER')    then   shorter=no()
+       when abbn('SHORTESt')   then  shortest=no()
+       when abbn('SMALl')      then     small=no()
+       when abbn('SMALLER')    then   smaller=no()
+       when abbn('SMALLESt')   then  smallest=no()
+       when abbn('UPPercase')  then upperCase=no()
+       when  abb('WIDth')      then        sw=nai()
+       otherwise nop
+       end    /*select*/
+  end         /*do while opts\== ...*/
+
+mc=int(mc,'monthscalender'); if mc>0 then cal=1
+days='Sunday Monday Tuesday Wednesday Thursday Friday Saturday'
+months='January February March April May June July August September October November December'
+days=' 'days;  months=' 'months
+cyyyy=right(date(),4);  hyy=left(cyyyy,2);  lyy=right(cyyyy,2)
+dy.=31; _=30; parse var _ dy.4 1 dy.6 1 dy.9 1 dy.11; dy.2=28+ly(yyyy)
+yy=right(yyyy,2); sd=p(sd 43); sw=p(sw 80); cw=10; cindent=1; calwidth=76
+if small    then do; narrow=1   ; short=1   ; end
+if smaller  then do; narrower=1 ; shorter=1 ; end
+if smallest then do; narrowest=1; shortest=1; end
+if shortest then shorter=1
+if shorter  then short  =1
+if narrow    then do; cw=9; cindent=3; calwidth=69; end
+if narrower  then do; cw=4; cindent=1; calwidth=34; end
+if narrowest then do; cw=2; cindent=1; calwidth=20; end
+cv_=calwidth+calspaces+2
+calfill=left(copies(calfill,cw),cw)
+      do j=1 for 7;         _=word(days,j)
+            do jw=1 for 3;  _d=strip(substr(_,cw*jw-cw+1,cw))
+            if jw=1 then _d=centre(_d,cw+1)
+                    else _d=left(_d,cw+1)
+            days.jw=days.jw||_d
+            end   /*jw*/
+      __=daysn
+      if narrower  then daysn=__||centre(left(_,3),5)
+      if narrowest then daysn=__||center(left(_,2),3)
+      end   /*j*/
+_yyyy=yyyy; calPuts=0; cv=1; _mm=mm+0; month=word(months,mm)
+dy.2=28+ly(_yyyy); dim=dy._mm; _dd=01; dow=dow(_mm,_dd,_yyyy); $dd=dd+0
+
+/*─────────────────────────────now: the business of the building the cal*/
+call calGen
+               do _j=2 to mc
+               if cv_\=='' then do
+                                cv=cv+cv_
+                                if cv+cv_>=sw then do; cv=1; call calPut
+                                                   call fcalPuts;call calPb
+                                                   end
+                                              else calPuts=0
+                                end
+                           else do;call calPb;call calPut;call fcalPuts;end
+               _mm=_mm+1;  if _mm==13 then do;  _mm=1; _yyyy=_yyyy+1;  end
+               month=word(months,_mm); dy.2=28+ly(_yyyy); dim=dy._mm
+               dow=dow(_mm,_dd,_yyyy); $dd=0; call calGen
+               end   /*_j*/
+call fcalPuts
+return _
+
+/*─────────────────────────────calGen subroutine────────────────────────*/
+calGen: cellX=;cellJ=;cellM=;calCells=0;calline=0
+call calPut
+call calPutl copies('─',calwidth),"┌┐"; call calHd
+call calPutl month ' ' _yyyy          ; call calHd
+if narrowest | narrower then call calPutl daysn
+                        else do jw=1 for 3
+                             if space(days.jw)\=='' then call calPutl days.jw
+                             end
+calft=1; calfb=0
+  do jf=1 for dow-1; call cellDraw calFill,calFill; end
+  do jy=1 for dim; call cellDraw jy; end
+calfb=1
+  do 7; call cellDraw calFill,calFill; end
+if sd>32 & \shorter then call calPut
+return
+
+/*─────────────────────────────cellDraw subroutine──────────────────────*/
+cellDraw: parse arg zz,cdDOY;zz=right(zz,2);calCells=calCells+1
+if calCells>7 then do
+                   calLine=calLine+1
+                   cellX=substr(cellX,2)
+                   cellJ=substr(cellJ,2)
+                   cellM=substr(cellM,2)
+                   cellB=translate(cellX,,")(─-"#)
+                   if calLine==1 then call cx
+                   call calCsm; call calPutl cellX; call calCsj; call cx
+                   cellX=; cellJ=; cellM=; calCells=1
+                   end
+cdDOY=right(cdDOY,cw); cellM=cellM'│'center('',cw)
+cellX=cellX'│'centre(zz,cw); cellJ=cellJ'│'center('',cw)
+return
+
+/*═════════════════════════════general 1-line subs══════════════════════*/
+abb: arg abbu; parse arg abb; return abbrev(abbu,_,abbl(abb))
+abbl: return verify(arg(1)'a',@abc,'M')-1
+abbn: parse arg abbn; return abb(abbn) | abb('NO'abbn)
+calCsj: if sd>49 & \shorter then call calPutl cellB; if sd>24 & \short    then call calPutl cellJ; return
+calCsm: if sd>24 & \short   then call calPutl cellM; if sd>49 & \shorter  then call calPutl cellB; return
+calHd:  if sd>24 & \shorter then call calPutl      ; if sd>32 & \shortest then call calPutl      ; return
+calPb:  calPuts=calPuts+1; maxKalPuts=max(maxKalPuts,calPuts); if symbol('CT.'calPuts)\=='VAR' then ct.calPuts=; ct.calPuts=overlay(arg(1),ct.calPuts,cv); return
+calPutl: call calPut copies(' ',cindent)left(arg(2)"│",1)center(arg(1),calwidth)||right('│'arg(2),1);return
+cx:cx_='├┤';cx=copies(copies('─',cw)'┼',7);if calft then do;cx=translate(cx,'┬',"┼");calft=0;end;if calfb then do;cx=translate(cx,'┴',"┼");cx_='└┘';calfb=0;end;call calPutl cx,cx_;return
+dow: procedure; arg m,d,y; if m<3 then do; m=m+12; y=y-1; end; yl=left(y,2); yr=right(y,2); w=(d+(m+1)*26%10+yr+yr%4+yl%4+5*yl)//7; if w==0 then w=7; return w
+er :parse arg _1,_2; call '$ERR' "14"p(_1) p(word(_1,2) !fid(1)) _2;if _1<0 then return _1; exit result
+err: call er '-'arg(1),arg(2); return ''
+erx: call er '-'arg(1),arg(2); exit ''
+fcalPuts: do j=1 for maxKalPuts; call put ct.j; end; ct.=; maxKalPuts=0; calPuts=0; return
+int: int=numx(arg(1),arg(2));if \isint(int) then call erx 92,arg(1) arg(2); return int/1
+is#: return verify(arg(1),#)==0
+isint: return datatype(arg(1),'W')
+lower:return translate(arg(1),@abc,@abcU)
+ly: if arg(1)\=='' then call erx 01,arg(2);parse var ops na ops;if na=='' then call erx 35,_o;return na
+nai: return int(na(),_o)
+nan: return numx(na(),_o)
+no: if arg(1)\=='' then call erx 01,arg(2); return left(_,2)\=='NO'
+num: procedure;parse arg x .,f,q;if x=='' then return x;if datatype(x,'N') then return x/1;x=space(translate(x,,','),0);if datatype(x,'N') then return x/1;return numnot()
+numnot: if q==1 then return x;if q=='' then call er 53,x f;call erx 53,x f
+numx: return num(arg(1),arg(2),1)
+p: return word(arg(1),1)
+put: _=arg(1);_=translate(_,,'_'chk);if \grid then _=ungrid(_);if lowerCase then _=lower(_);if upperCase then upper _;if shortest&_=' ' then return;call tell _;return
+tell: say arg(1);return
+ungrid: return translate(arg(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")
diff --git a/Task/Calendar/Ruby/calendar.rb b/Task/Calendar/Ruby/calendar.rb
new file mode 100644
index 0000000000..c6ac3140b3
--- /dev/null
+++ b/Task/Calendar/Ruby/calendar.rb
@@ -0,0 +1,70 @@
+require 'date'
+
+# Creates a calendar of _year_. Returns this calendar as a multi-line
+# string fit to _columns_.
+def cal(year, columns)
+
+  # Start at January 1.
+  #
+  # Date::ENGLAND marks the switch from Julian calendar to Gregorian
+  # calendar at 1752 September 14. This removes September 3 to 13 from
+  # year 1752. (By fortune, it keeps January 1.)
+  #
+  date = Date.new(year, 1, 1, Date::ENGLAND)
+
+  # Collect calendars of all 12 months.
+  months = (1..12).collect do |month|
+    rows = [Date::MONTHNAMES[month].center(20), "Su Mo Tu We Th Fr Sa"]
+
+    # Make array of 42 days, starting with Sunday.
+    days = []
+    date.wday.times { days.push "  " }
+    while date.month == month
+      days.push("%2d" % date.mday)
+      date += 1
+    end
+    (42 - days.length).times { days.push "  " }
+
+    days.each_slice(7) { |week| rows.push(week.join " ") }
+    next rows
+  end
+
+  # Calculate months per row (mpr).
+  #  1. Divide columns by 22 columns per month, rounded down. (Pretend
+  #     to have 2 extra columns; last month uses only 20 columns.)
+  #  2. Decrease mpr if 12 months would fit in the same months per
+  #     column (mpc). For example, if we can fit 5 mpr and 3 mpc, then
+  #     we use 4 mpr and 3 mpc.
+  mpr = (columns + 2).div 22
+  mpr = 12.div((12 + mpr - 1).div mpr)
+
+  # Use 20 columns per month + 2 spaces between months.
+  width = mpr * 22 - 2
+
+  # Join months into calendar.
+  rows = ["[Snoopy]".center(width), "#{year}".center(width)]
+  months.each_slice(mpr) do |slice|
+    slice[0].each_index do |i|
+      rows.push(slice.map {|a| a[i]}.join "  ")
+    end
+  end
+  return rows.join("\n")
+end
+
+
+ARGV.length == 1 or abort "usage: #{$0} year"
+
+# Guess width of terminal.
+#  1. Obey environment variable COLUMNS.
+#  2. Try to require 'io/console' from Ruby 1.9.3.
+#  3. Try to run `tput co`.
+#  4. Assume 80 columns.
+columns = begin Integer(ENV["COLUMNS"] || "")
+          rescue
+            begin require 'io/console'; IO.console.winsize[1]
+            rescue LoadError
+              begin Integer(`tput co`)
+              rescue
+                80; end; end; end
+
+puts cal(Integer(ARGV[0]), columns)
diff --git a/Task/Calendar/Scala/calendar.scala b/Task/Calendar/Scala/calendar.scala
new file mode 100644
index 0000000000..12f1dfb289
--- /dev/null
+++ b/Task/Calendar/Scala/calendar.scala
@@ -0,0 +1,203 @@
+import java.util.TimeZone
+import java.util.Locale
+import java.util.Calendar
+import java.util.GregorianCalendar
+
+object Helper {
+  def monthsMax(locale: Locale = Locale.getDefault): Int = {
+    val cal = Calendar.getInstance(locale)
+    cal.getMaximum(Calendar.MONTH)
+  }
+
+  def numberOfMonths(locale: Locale = Locale.getDefault): Int = monthsMax(locale)+1
+
+  def namesOfMonths(year: Int, locale: Locale = Locale.getDefault): List[String] = {
+    val cal = Calendar.getInstance(locale)
+    val f1: Int => String = i => {
+      cal.set(year,i,1)
+      cal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale)
+    }
+    (0 to monthsMax(locale)) map f1 toList
+  }
+
+  def jgt(cal: GregorianCalendar): Int = {cal.setTime(cal.getGregorianChange); cal.get(Calendar.YEAR)}
+
+  def isJGT(year: Int, cal: GregorianCalendar) = year==jgt(cal)
+
+  def offsets(year: Int, locale: Locale = Locale.getDefault): List[Int] = {
+    val cal = Calendar.getInstance(locale)
+    val months = cal.getMaximum(Calendar.MONTH)
+    val f1: Int => Int = i => {
+      cal.set(year,i,1)
+      cal.get(Calendar.DAY_OF_WEEK)
+    }
+    ((0 to months) map f1 toList) map {i=>if((i-2)<0) i+5 else i-2}
+  }
+
+  def headerNameOfDays(locale: Locale = Locale.getDefault) = {
+    val cal = Calendar.getInstance(locale)
+    val mdow = cal.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale) // map days of week
+    val it = mdow.keySet.iterator
+    import scala.collection.mutable.ListBuffer
+    val lb = new ListBuffer[String]
+    while (it.hasNext) lb+=it.next
+    val lpdow = lb.toList.map{k=>(mdow.get(k),k.substring(0,2))} // list pair days of week
+    (lpdow map {p=>if((p._1-2)<0) (p._1+5, p._2) else (p._1-2, p._2)} sortWith(_._1<_._1) map (_._2)).foldRight("")(_+" "+_)
+  }
+
+}
+
+object CalendarPrint extends App {
+  import Helper._
+
+  val tzd = TimeZone.getDefault
+  val locd = Locale.getDefault
+
+  def printCalendar(year: Int, printerWidth: Int, loc: Locale, tz: TimeZone) = {
+
+    def getCal: List[Triple[Int, Int, String]] = {
+      val cal = new GregorianCalendar(tz, loc)
+
+      def getGregCal: List[Triple[Int, Int, String]] = {
+        val month = 0
+        val day = 1
+        cal.set(year,month,day)
+        val f1: Int => Triple[Int, Int, Int] = i => {
+          val cal = Calendar.getInstance(tz, loc)
+          cal.set(year,i,1)
+          val minday = cal.getActualMinimum(Calendar.DAY_OF_MONTH)
+          val maxday = cal.getActualMaximum(Calendar.DAY_OF_MONTH)
+          (i, minday, maxday)
+        }
+        val limits = (0 to monthsMax(loc)) map f1
+        val f2: (Int, Int, Int) => String = (year, month, day) => {
+          val cal = Calendar.getInstance(tz, loc)
+          cal.set(year,month,day)
+          cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, loc)
+        }
+        val calend = for {
+          i <- 0 to monthsMax(loc)
+          j <- limits(i)._2 to limits(i)._3
+          val dow = f2(year, i, j)
+        } yield (i, j, dow)
+        if (isJGT(year, new GregorianCalendar(tz, loc))) calend.filter{_._1!=9}.toList else calend.toList
+      }
+
+      def getJGT: List[Triple[Int, Int, String]] = {
+        if (!isJGT(year, new GregorianCalendar(tz, loc))) return Nil
+
+        val cal = new GregorianCalendar(tz, loc)
+        cal.set(year,9,1)
+        var ldom = 0
+        def it = new Iterator[Tuple3[Int,Int, String]]{
+          def next={
+            val res = (cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.GERMAN))
+            ldom = res._2
+            cal.roll(Calendar.DAY_OF_MONTH, true)
+            res
+          }
+          def hasNext = (cal.get(Calendar.DAY_OF_MONTH)>ldom)
+        }
+        it.toList
+      }
+      (getGregCal++getJGT).sortWith((s,t)=>s._1*100+s._2300) 300 else printerWidth
+
+        def getFGW(msbs: Int,gsm: Int) = {val r=(pw-msbs*mw-gsm)/2; (r,gwf,r)}   // fixed gap width
+        def getVGW(msbs: Int,gsm: Int) = pw-msbs*mw-gsm match {                  // variable gap width
+                                           case a if (a<2*gwm) => (a/2,gwm,a/2)
+                                           case b => {val x = (b+gsm)/(msbs+1); (x,x,x)}
+                                         }
+
+        // months side by side, gaps sum minimum
+        val (msbs, gsm) = {
+          val (x, y) = {val c = if (pw/mw>12) 12 else pw/mw; if (c*mw+(c-1)*gwm<=pw) (c, c*gwm) else (c-1, (c-1)*gwm)}
+          val x1 = x match {
+            case 5 => 4
+            case a if (a>6 && a<12) => 6
+            case other => other
+          }
+          (x1, (x1-1)*gwm)
+        }
+
+        // left margin, gap width, right margin
+        val (lm,gw,rm) = if (fgw) getFGW(msbs,gsm) else getVGW(msbs,gsm)
+        (pw,msbs,lm,gw,rm)
+      }
+
+      val (pw,msbs,lm,gw,rm) = limits(printerWidth)
+      val monthsList = (0 to monthsMax(loc)).map{m=>calList.filter{_._1==m}}.toList
+      val nom = namesOfMonths(year,loc)
+      val offsetList = offsets(year,loc)
+      val hnod = headerNameOfDays(loc)
+
+      val fsplit: List[(Int, Int, String)] => List[String] = list => {
+	    val fap: Int => (Int, Int) = p => (p/7,p%7)
+	    clear
+	    for (i <- 0 until list.size) arr(fap(i+offsetList(list(i)._1))._1)(fap(i+offsetList(list(i)._1))._2)="%2d".format(list(i)._2)
+	    //arr.toList.map(_.toList).map(_.foldLeft("")(_+" "+_))
+	    arr.toList.map(_.toList).map(_.foldRight("")(_+" "+_))
+	  }
+      val monthsRows = monthsList.map(fsplit)
+
+      val center: (String, Int) => String = (s,l) => {
+        if (s.size>=l) s.substring(0,l) else
+        (" "*((l-s.size)/2)+s+" "*((l-s.size)/2)+" ").substring(0,l)
+      }
+
+      println(center("[Snoopy Picture]",pw))
+      println
+      println(center(""+year,pw))
+      println
+
+      val ul = numberOfMonths(loc)
+      val rowblocks = (1 to ul/msbs).map{i=>
+        (0 to 5).map{j=>
+          val lb = new scala.collection.mutable.ListBuffer[String]
+          val k = (i-1)*msbs
+          (k to k+msbs-1).map{l=>
+            lb+=monthsRows(l)(j)
+          }
+          lb.toList
+        }.toList
+      }.toList
+
+      val mheaders = (1 to ul/msbs).map{i=>(0 to msbs-1).map{j=>center(nom(j+(i-1)*msbs),20)}.toList}.toList
+      val dowheaders = (1 to ul/msbs).map{i=>(0 to msbs-1).map{j=>center(hnod,20)}.toList}.toList
+
+      (1 to 12/msbs).foreach{i=>
+        println(" "*lm+mheaders(i-1).foldRight("")(_+" "*gw+_))
+        println(" "*lm+dowheaders(i-1).foldRight("")(_+" "*gw+_))
+        rowblocks(i-1).foreach{xs=>println(" "*lm+xs.foldRight("")(_+" "*(gw-1)+_))}
+        println
+      }
+
+    }
+
+    val calList = getCal
+    printCal(calList)
+
+  }
+
+  def printGregCal(year: Int = 1969, pw: Int = 80, JGT: Boolean = false, loc: Locale = Locale.getDefault, tz: TimeZone = TimeZone.getDefault) {
+    val _year = if (JGT==false) year else jgt(new GregorianCalendar(tz, loc))
+    printCalendar(_year, pw, loc, tz)
+  }
+
+  printGregCal()
+  printGregCal(JGT=true, loc=Locale.UK, pw=132, tz=TimeZone.getTimeZone("UK/London"))
+
+}
diff --git a/Task/Calendar/Tcl/calendar-2.tcl b/Task/Calendar/Tcl/calendar-2.tcl
new file mode 100644
index 0000000000..1888a798cc
--- /dev/null
+++ b/Task/Calendar/Tcl/calendar-2.tcl
@@ -0,0 +1,2 @@
+snoopy
+cal 1969
diff --git a/Task/Calendar/Tcl/calendar-3.tcl b/Task/Calendar/Tcl/calendar-3.tcl
new file mode 100644
index 0000000000..a3d02cd3dc
--- /dev/null
+++ b/Task/Calendar/Tcl/calendar-3.tcl
@@ -0,0 +1,2 @@
+snoopy
+cal 1582 :Europe/Madrid es_ES
diff --git a/Task/Calendar/Tcl/calendar.tcl b/Task/Calendar/Tcl/calendar.tcl
new file mode 100644
index 0000000000..41150455f4
--- /dev/null
+++ b/Task/Calendar/Tcl/calendar.tcl
@@ -0,0 +1,75 @@
+package require Tcl 8.5
+
+# Produce information about the days in a month, without any assumptions about
+# what those days actually are.
+proc calMonthDays {timezone locale year month} {
+    set days {}
+    set moment [clock scan [format "%04d-%02d-00 12:00" $year $month] \
+	    -timezone $timezone -locale $locale -format "%Y-%m-%d %H:%M"]
+    while 1 {
+	set moment [clock add $moment 1 day]
+	lassign [clock format $moment -timezone $timezone -locale $locale \
+		-format "%m %d %u"] m d dow
+	if {[scan $m %d] != $month} {
+	    return $days
+	}
+	lappend days $moment [scan $d %d] $dow
+    }
+}
+
+proc calMonth {year month timezone locale} {
+    set dow 0
+    set line ""
+    set lines {}
+    foreach {t day dayofweek} [calMonthDays $timezone $locale $year $month] {
+	if {![llength $lines]} {lappend lines $t}
+	if {$dow > $dayofweek} {
+	    lappend lines [string trimright $line]
+	    set line ""
+	    set dow 0
+	}
+	while {$dow < $dayofweek-1} {
+	    append line "   "
+	    incr dow
+	}
+	append line [format "%2d " $day]
+	set dow $dayofweek
+    }
+    lappend lines [string trimright $line]
+}
+
+proc cal3Month {year month timezone locale} {
+    # Extract the month data
+    set d1 [lassign [calMonth $year $month $timezone $locale] t1]; incr month
+    set d2 [lassign [calMonth $year $month $timezone $locale] t2]; incr month
+    set d3 [lassign [calMonth $year $month $timezone $locale] t3]
+    # Print the header line of month names
+    foreach t [list $t1 $t2 $t3] {
+	set m [clock format $t -timezone $timezone -locale $locale -format "%B"]
+	set l [expr {10 + [string length $m]/2}]
+	puts -nonewline [format "%-25s" [format "%*s" $l $m]]
+    }
+    puts ""
+    # Print the month days
+    foreach l1 $d1 l2 $d2 l3 $d3 {
+	puts [format "%-25s%-25s%s" $l1 $l2 $l3]
+    }
+}
+
+proc cal {{year ""} {timezone :localtime} {locale en}} {
+    if {$year eq ""} {
+	set year [clock format [clock seconds] -format %Y]
+    }
+    puts [format "%40s" "-- $year --"]
+    foreach m {1 4 7 10} {
+	puts ""
+	cal3Month $year $m $timezone $locale
+    }
+}
+
+proc snoopy {} {
+    puts [format "%43s\n" {[Snoopy Picture]}]
+}
+
+snoopy
+cal
diff --git a/Task/Check_that_file_exists/0DESCRIPTION b/Task/Check_that_file_exists/0DESCRIPTION
new file mode 100644
index 0000000000..ccf27b821e
--- /dev/null
+++ b/Task/Check_that_file_exists/0DESCRIPTION
@@ -0,0 +1 @@
+In this task, the job is to verify that a file called "input.txt" and the directory called "docs" exist. This should be done twice: once for the current working directory and once for a file and a directory in the filesystem root.
diff --git a/Task/Check_that_file_exists/1META.yaml b/Task/Check_that_file_exists/1META.yaml
new file mode 100644
index 0000000000..40458d9f21
--- /dev/null
+++ b/Task/Check_that_file_exists/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: File System Operations
diff --git a/Task/Check_that_file_exists/BASIC/check_that_file_exists-2.bas b/Task/Check_that_file_exists/BASIC/check_that_file_exists-2.bas
new file mode 100644
index 0000000000..d256870060
--- /dev/null
+++ b/Task/Check_that_file_exists/BASIC/check_that_file_exists-2.bas
@@ -0,0 +1,14 @@
+ON ERROR GOTO ohNo
+d$ = "docs"
+CHDIR d$
+d$ = "\docs"
+CHDIR d$
+END
+
+ohNo:
+    IF 76 = ERR THEN
+        PRINT d$; " not found"
+    ELSE
+        PRINT "Unknown error"
+    END IF
+    RESUME NEXT
diff --git a/Task/Check_that_file_exists/BASIC/check_that_file_exists-3.bas b/Task/Check_that_file_exists/BASIC/check_that_file_exists-3.bas
new file mode 100644
index 0000000000..1ec1ca4add
--- /dev/null
+++ b/Task/Check_that_file_exists/BASIC/check_that_file_exists-3.bas
@@ -0,0 +1,21 @@
+f$ = "input.txt"
+GOSUB opener
+f$ = "\input.txt"
+GOSUB opener
+
+'can't directly check for directories,
+'but can check for the NUL device in the desired dir
+f$ = "docs\nul"
+GOSUB opener
+f$ = "\docs\nul"
+GOSUB opener
+END
+
+opener:
+    d$ = DIR$(f$)
+    IF LEN(d$) THEN
+        PRINT f$; " found"
+    ELSE
+        PRINT f$; " not found"
+    END IF
+    RETURN
diff --git a/Task/Check_that_file_exists/BASIC/check_that_file_exists.bas b/Task/Check_that_file_exists/BASIC/check_that_file_exists.bas
new file mode 100644
index 0000000000..8d1f97f205
--- /dev/null
+++ b/Task/Check_that_file_exists/BASIC/check_that_file_exists.bas
@@ -0,0 +1,28 @@
+ON ERROR GOTO ohNo
+f$ = "input.txt"
+GOSUB opener
+f$ = "\input.txt"
+GOSUB opener
+
+'can't directly check for directories,
+'but can check for the NUL device in the desired dir
+f$ = "docs\nul"
+GOSUB opener
+f$ = "\docs\nul"
+GOSUB opener
+END
+
+opener:
+    e$ = " found"
+    OPEN f$ FOR INPUT AS 1
+    PRINT f$; e$
+    CLOSE
+    RETURN
+
+ohNo:
+    IF (53 = ERR) OR (76 = ERR) THEN
+        e$ = " not" + e$
+    ELSE
+        e$ = "Unknown error"
+    END IF
+    RESUME NEXT
diff --git a/Task/Check_that_file_exists/C/check_that_file_exists.c b/Task/Check_that_file_exists/C/check_that_file_exists.c
new file mode 100644
index 0000000000..fbced86d47
--- /dev/null
+++ b/Task/Check_that_file_exists/C/check_that_file_exists.c
@@ -0,0 +1,28 @@
+#include 
+#include 
+#include 
+#include 
+
+/* Check for regular file. */
+int check_reg(const char *path) {
+	struct stat sb;
+	return stat(path, &sb) == 0 && S_ISREG(sb.st_mode);
+}
+
+/* Check for directory. */
+int check_dir(const char *path) {
+	struct stat sb;
+	return stat(path, &sb) == 0 && S_ISDIR(sb.st_mode);
+}
+
+int main() {
+	printf("input.txt is a regular file? %s\n",
+	    check_reg("input.txt") ? "yes" : "no");
+	printf("docs is a directory? %s\n",
+	    check_dir("docs") ? "yes" : "no");
+	printf("/input.txt is a regular file? %s\n",
+	    check_reg("/input.txt") ? "yes" : "no");
+	printf("/docs is a directory? %s\n",
+	    check_dir("/docs") ? "yes" : "no");
+	return 0;
+}
diff --git a/Task/Check_that_file_exists/Clojure/check_that_file_exists.clj b/Task/Check_that_file_exists/Clojure/check_that_file_exists.clj
new file mode 100644
index 0000000000..957bc4c9db
--- /dev/null
+++ b/Task/Check_that_file_exists/Clojure/check_that_file_exists.clj
@@ -0,0 +1,17 @@
+(import '(java.io File))
+
+(defn kind [filename]
+  (let [f (File. filename)]
+    (cond
+      (.isFile f)      "file"
+      (.isDirectory f) "directory"
+      (.exists f)      "other"
+      :else            "(non-existent)" )))
+
+(defn look-for [filename]
+  (println filename ":" (kind filename)))
+
+(look-for "input.txt")
+(look-for "/input.txt")
+(look-for "docs")
+(look-for "/docs")
diff --git a/Task/Check_that_file_exists/Erlang/check_that_file_exists.erl b/Task/Check_that_file_exists/Erlang/check_that_file_exists.erl
new file mode 100644
index 0000000000..b21ff923b0
--- /dev/null
+++ b/Task/Check_that_file_exists/Erlang/check_that_file_exists.erl
@@ -0,0 +1,23 @@
+#!/usr/bin/escript
+file_exists(Filename) ->
+  { Flag, _ } = file:read_file_info(Filename), Flag == ok.
+
+dir_exists(Filename) ->
+  { Flag, Info } = file:read_file_info(Filename),
+  (Flag == ok) andalso (element(3, Info) == directory).
+
+print_result(Flag, Filename) ->
+  Tail = if
+    Flag -> "exists";
+    true -> "does not exist"
+  end,
+  io:put_chars(lists:concat([Filename, " ", Tail, "\n"])).
+
+check_file(Filename) -> print_result(file_exists(Filename), Filename).
+check_dir(Filename) -> print_result(dir_exists(Filename), Filename).
+
+main(_) ->
+  check_file("input.txt"),
+  check_dir("docs"),
+  check_file("/input.txt"),
+  check_dir("/docs").
diff --git a/Task/Check_that_file_exists/Forth/check_that_file_exists.fth b/Task/Check_that_file_exists/Forth/check_that_file_exists.fth
new file mode 100644
index 0000000000..aac193b53d
--- /dev/null
+++ b/Task/Check_that_file_exists/Forth/check_that_file_exists.fth
@@ -0,0 +1,5 @@
+: .exists ( str len -- ) 2dup file-status nip 0= if type ."  exists" else type ."  does not exist" then ;
+ s" input.txt" .exists
+s" /input.txt" .exists
+ s" docs" .exists
+s" /docs" .exists
diff --git a/Task/Check_that_file_exists/Fortran/check_that_file_exists-2.f b/Task/Check_that_file_exists/Fortran/check_that_file_exists-2.f
new file mode 100644
index 0000000000..99e99ece03
--- /dev/null
+++ b/Task/Check_that_file_exists/Fortran/check_that_file_exists-2.f
@@ -0,0 +1,9 @@
+logical :: dir_e
+! a trick to be sure docs is a dir
+inquire( file="./docs/.", exist=dir_e )
+if ( dir_e ) then
+  write(*,*), "dir exists!"
+else
+  ! workaround: it calls an extern program...
+  call system('mkdir docs')
+end if
diff --git a/Task/Check_that_file_exists/Fortran/check_that_file_exists.f b/Task/Check_that_file_exists/Fortran/check_that_file_exists.f
new file mode 100644
index 0000000000..b03ca11948
--- /dev/null
+++ b/Task/Check_that_file_exists/Fortran/check_that_file_exists.f
@@ -0,0 +1,4 @@
+LOGICAL :: file_exists
+INQUIRE(FILE="input.txt", EXIST=file_exists)   ! file_exists will be TRUE if the file
+                                               ! exists and FALSE otherwise
+INQUIRE(FILE="/input.txt", EXIST=file_exists)
diff --git a/Task/Check_that_file_exists/Go/check_that_file_exists.go b/Task/Check_that_file_exists/Go/check_that_file_exists.go
new file mode 100644
index 0000000000..f4fde08d58
--- /dev/null
+++ b/Task/Check_that_file_exists/Go/check_that_file_exists.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+    "fmt"
+    "os"
+)
+
+func printStat(p string) {
+    switch i, err := os.Stat(p); {
+    case err != nil:
+        fmt.Println(err)
+    case i.IsDir():
+        fmt.Println(p, "is a directory")
+    default:
+        fmt.Println(p, "is a file")
+    }
+}
+
+func main() {
+    printStat("input.txt")
+    printStat("/input.txt")
+    printStat("docs")
+    printStat("/docs")
+}
diff --git a/Task/Check_that_file_exists/Haskell/check_that_file_exists.hs b/Task/Check_that_file_exists/Haskell/check_that_file_exists.hs
new file mode 100644
index 0000000000..83c6bf60c4
--- /dev/null
+++ b/Task/Check_that_file_exists/Haskell/check_that_file_exists.hs
@@ -0,0 +1,13 @@
+import System.IO
+import System.Directory
+
+check :: (FilePath -> IO Bool) -> FilePath -> IO ()
+check p s = do
+  result <- p s
+  putStrLn $ s ++ if result then " does exist" else " does not exist"
+
+main = do
+  check doesFileExist "input.txt"
+  check doesDirectoryExist "docs"
+  check doesFileExist "/input.txt"
+  check doesDirectoryExist "/docs"
diff --git a/Task/Check_that_file_exists/Java/check_that_file_exists-2.java b/Task/Check_that_file_exists/Java/check_that_file_exists-2.java
new file mode 100644
index 0000000000..fe89c6ade7
--- /dev/null
+++ b/Task/Check_that_file_exists/Java/check_that_file_exists-2.java
@@ -0,0 +1,20 @@
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+public class FileExistsTest{
+   private static FileSystem defaultFS = FileSystems.getDefault();
+   public static boolean isFileExists(String filename){
+       return Files.exists(defaultFS.getPath(filename));
+   }
+   public static void test(String type, String filename){
+       System.out.println("The following " + type + " called " + filename +
+           (isFileExists(filename) ? " exists." : " not exists.")
+       );
+   }
+   public static void main(String args[]){
+        test("file", "input.txt");
+        test("file", defaultFS.getSeparator() + "input.txt");
+        test("directory", "docs");
+        test("directory", defaultFS.getSeparator() + "docs" + defaultFS.getSeparator());
+   }
+}
diff --git a/Task/Check_that_file_exists/Java/check_that_file_exists.java b/Task/Check_that_file_exists/Java/check_that_file_exists.java
new file mode 100644
index 0000000000..4454deb2d1
--- /dev/null
+++ b/Task/Check_that_file_exists/Java/check_that_file_exists.java
@@ -0,0 +1,18 @@
+import java.io.File;
+public class FileExistsTest {
+   public static boolean isFileExists(String filename) {
+       boolean exists = new File(filename).exists();
+       return exists;
+   }
+   public static void test(String type, String filename) {
+       System.out.println("The following " + type + " called " + filename +
+           (isFileExists(filename) ? " exists." : " not exists.")
+       );
+   }
+   public static void main(String args[]) {
+        test("file", "input.txt");
+        test("file", File.separator + "input.txt");
+        test("directory", "docs");
+        test("directory", File.separator + "docs" + File.separator);
+   }
+}
diff --git a/Task/Check_that_file_exists/JavaScript/check_that_file_exists.js b/Task/Check_that_file_exists/JavaScript/check_that_file_exists.js
new file mode 100644
index 0000000000..bb1019ac91
--- /dev/null
+++ b/Task/Check_that_file_exists/JavaScript/check_that_file_exists.js
@@ -0,0 +1,6 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+
+fso.FileExists('input.txt');
+fso.FileExists('c:/input.txt');
+fso.FolderExists('docs');
+fso.FolderExists('c:/docs');
diff --git a/Task/Check_that_file_exists/Lua/check_that_file_exists-2.lua b/Task/Check_that_file_exists/Lua/check_that_file_exists-2.lua
new file mode 100644
index 0000000000..cf6fc8a00b
--- /dev/null
+++ b/Task/Check_that_file_exists/Lua/check_that_file_exists-2.lua
@@ -0,0 +1,9 @@
+require "lfs"
+for i, path in ipairs({"input.txt", "/input.txt", "docs", "/docs"}) do
+    local mode = lfs.attributes(path, "mode")
+    if mode then
+        print(path .. " exists and is a " .. mode .. ".")
+    else
+        print(path .. " does not exist.")
+    end
+end
diff --git a/Task/Check_that_file_exists/Lua/check_that_file_exists.lua b/Task/Check_that_file_exists/Lua/check_that_file_exists.lua
new file mode 100644
index 0000000000..192a01934b
--- /dev/null
+++ b/Task/Check_that_file_exists/Lua/check_that_file_exists.lua
@@ -0,0 +1,12 @@
+function output( s, b )
+    if b then
+        print ( s, " does not exist." )
+    else
+        print ( s, " does exist." )
+    end
+end
+
+output( "input.txt",  io.open( "input.txt", "r" ) == nil )
+output( "/input.txt", io.open( "/input.txt", "r" ) == nil )
+output( "docs",  io.open( "docs", "r" ) == nil )
+output( "/docs", io.open( "/docs", "r" ) == nil )
diff --git a/Task/Check_that_file_exists/PHP/check_that_file_exists.php b/Task/Check_that_file_exists/PHP/check_that_file_exists.php
new file mode 100644
index 0000000000..4f491fad83
--- /dev/null
+++ b/Task/Check_that_file_exists/PHP/check_that_file_exists.php
@@ -0,0 +1,4 @@
+if (file_exists('input.txt')) echo 'input.txt is here right by my side';
+if (file_exists('docs'     )) echo 'docs is here with me';
+if (file_exists('/input.txt')) echo 'input.txt is over there in the root dir';
+if (file_exists('/docs'    )) echo 'docs is over there in the root dir';
diff --git a/Task/Check_that_file_exists/Perl/check_that_file_exists.pl b/Task/Check_that_file_exists/Perl/check_that_file_exists.pl
new file mode 100644
index 0000000000..d12b48828a
--- /dev/null
+++ b/Task/Check_that_file_exists/Perl/check_that_file_exists.pl
@@ -0,0 +1,7 @@
+use File::Spec::Functions qw(catfile rootdir);
+# here
+print -e 'input.txt';
+print -d 'docs';
+# root dir
+print -e catfile rootdir, 'input.txt';
+print -d catfile rootdir, 'docs';
diff --git a/Task/Check_that_file_exists/PicoLisp/check_that_file_exists.l b/Task/Check_that_file_exists/PicoLisp/check_that_file_exists.l
new file mode 100644
index 0000000000..503ff761d7
--- /dev/null
+++ b/Task/Check_that_file_exists/PicoLisp/check_that_file_exists.l
@@ -0,0 +1,3 @@
+(if (info "file.txt")
+   (prinl "Size: " (car @) " bytes, last modified " (stamp (cadr @) (cddr @)))
+   (prinl "File doesn't exist") )
diff --git a/Task/Check_that_file_exists/Python/check_that_file_exists.py b/Task/Check_that_file_exists/Python/check_that_file_exists.py
new file mode 100644
index 0000000000..c8923a4f77
--- /dev/null
+++ b/Task/Check_that_file_exists/Python/check_that_file_exists.py
@@ -0,0 +1,6 @@
+import os
+
+os.path.exists("input.txt")
+os.path.exists("/input.txt")
+os.path.exists("docs")
+os.path.exists("/docs")
diff --git a/Task/Check_that_file_exists/R/check_that_file_exists.r b/Task/Check_that_file_exists/R/check_that_file_exists.r
new file mode 100644
index 0000000000..0b9f2b7a0f
--- /dev/null
+++ b/Task/Check_that_file_exists/R/check_that_file_exists.r
@@ -0,0 +1,7 @@
+file.exists("input.txt")
+file.exists("/input.txt")
+file.exists("docs")
+file.exists("/docs")
+
+# or
+file.exists("input.txt", "/input.txt", "docs", "/docs")
diff --git a/Task/Check_that_file_exists/Ruby/check_that_file_exists-2.rb b/Task/Check_that_file_exists/Ruby/check_that_file_exists-2.rb
new file mode 100644
index 0000000000..c41d8a3a71
--- /dev/null
+++ b/Task/Check_that_file_exists/Ruby/check_that_file_exists-2.rb
@@ -0,0 +1,4 @@
+["input.txt", "/input.txt"].each { |f|
+  printf "%s is a regular file? %s\n", f, File.file?(f) }
+["docs", "/docs"].each { |d|
+  printf "%s is a directory? %s\n", d, File.directory?(d) }
diff --git a/Task/Check_that_file_exists/Ruby/check_that_file_exists.rb b/Task/Check_that_file_exists/Ruby/check_that_file_exists.rb
new file mode 100644
index 0000000000..3eecbe44ee
--- /dev/null
+++ b/Task/Check_that_file_exists/Ruby/check_that_file_exists.rb
@@ -0,0 +1,4 @@
+File.file?("input.txt")
+File.file?("/input.txt")
+File.directory?("docs")
+File.directory?("/docs")
diff --git a/Task/Check_that_file_exists/Scheme/check_that_file_exists.ss b/Task/Check_that_file_exists/Scheme/check_that_file_exists.ss
new file mode 100644
index 0000000000..5a064bcb74
--- /dev/null
+++ b/Task/Check_that_file_exists/Scheme/check_that_file_exists.ss
@@ -0,0 +1 @@
+(file-exists? filename)
diff --git a/Task/Check_that_file_exists/Smalltalk/check_that_file_exists-2.st b/Task/Check_that_file_exists/Smalltalk/check_that_file_exists-2.st
new file mode 100644
index 0000000000..99798e8395
--- /dev/null
+++ b/Task/Check_that_file_exists/Smalltalk/check_that_file_exists-2.st
@@ -0,0 +1,4 @@
+(Directory name: 'docs') exists ifTrue: [ ... ]
+(Directory name: 'c:\docs') exists ifTrue: [ ... ]
+(File name: 'serial') isFile ifTrue: [ ... ]
+(File name: 'c:\serial') isFile ifTrue: [ ... ]
diff --git a/Task/Check_that_file_exists/Smalltalk/check_that_file_exists.st b/Task/Check_that_file_exists/Smalltalk/check_that_file_exists.st
new file mode 100644
index 0000000000..689e7011a3
--- /dev/null
+++ b/Task/Check_that_file_exists/Smalltalk/check_that_file_exists.st
@@ -0,0 +1,2 @@
+FileDirectory new fileExists: 'c:\serial'.
+(FileDirectory on: 'c:\') directoryExists: 'docs'.
diff --git a/Task/Check_that_file_exists/Tcl/check_that_file_exists.tcl b/Task/Check_that_file_exists/Tcl/check_that_file_exists.tcl
new file mode 100644
index 0000000000..748550ca14
--- /dev/null
+++ b/Task/Check_that_file_exists/Tcl/check_that_file_exists.tcl
@@ -0,0 +1,15 @@
+if { [file exists "input.txt"] } {
+    puts "input.txt exists"
+}
+
+if { [file exists [file nativename "/input.txt"]] } {
+    puts "/input.txt exists"
+}
+
+if { [file isdirectory "docs"] } {
+    puts "docs exists and is a directory"
+}
+
+if { [file isdirectory [file nativename "/docs"]] } {
+    puts "/docs exists and is a directory"
+}
diff --git a/Task/Checkpoint_synchronization/0DESCRIPTION b/Task/Checkpoint_synchronization/0DESCRIPTION
new file mode 100644
index 0000000000..3637045634
--- /dev/null
+++ b/Task/Checkpoint_synchronization/0DESCRIPTION
@@ -0,0 +1,11 @@
+The checkpoint synchronization is a problem of synchronizing multiple [[task]]s. Consider a workshop where several workers ([[task]]s) assembly details of some mechanism. When each of them completes his work they put the details together. There is no store, so a worker who finished its part first must wait for others before starting another one. Putting details together is the ''checkpoint'' at which [[task]]s synchronize themselves before going their paths apart.
+
+'''The task'''
+
+Implement checkpoint synchronization in your language.
+
+Make sure that the solution is [[Race condition|race condition]]-free. Note that a straightforward solution based on [[event]]s is exposed to [[Race condition|race condition]]. Let two [[task]]s A and B need to be synchronized at a checkpoint. Each signals its event (''EA'' and ''EB'' correspondingly), then waits for the AND-combination of the events (''EA''&''EB'') and resets its event. Consider the following scenario: A signals ''EA'' first and gets blocked waiting for ''EA''&''EB''. Then B signals ''EB'' and loses the processor. Then A is released (both events are signaled) and resets ''EA''. Now if B returns and enters waiting for ''EA''&''EB'', it gets lost.
+
+When a worker is ready it shall not continue before others finish. A typical implementation bug is when a worker is counted twice within one working cycle causing its premature completion. This happens when the quickest worker serves its cycle two times while the laziest one is lagging behind.
+
+If you can, implement workers joining and leaving.
diff --git a/Task/Checkpoint_synchronization/1META.yaml b/Task/Checkpoint_synchronization/1META.yaml
new file mode 100644
index 0000000000..f6cada46d5
--- /dev/null
+++ b/Task/Checkpoint_synchronization/1META.yaml
@@ -0,0 +1,6 @@
+---
+category:
+- Classic CS problems and programs
+note: Concurrency
+requires:
+- Concurrency
diff --git a/Task/Checkpoint_synchronization/C/checkpoint_synchronization.c b/Task/Checkpoint_synchronization/C/checkpoint_synchronization.c
new file mode 100644
index 0000000000..601c09e33a
--- /dev/null
+++ b/Task/Checkpoint_synchronization/C/checkpoint_synchronization.c
@@ -0,0 +1,31 @@
+#include 
+#include 
+#include 
+#include 
+
+int main()
+{
+        int jobs = 41, tid;
+        omp_set_num_threads(5);
+
+        #pragma omp parallel shared(jobs) private(tid)
+        {
+                tid = omp_get_thread_num();
+                while (jobs > 0) {
+                        /* this is the checkpoint */
+                        #pragma omp barrier
+                        if (!jobs) break;
+
+                        printf("%d: taking job %d\n", tid, jobs--);
+                        usleep(100000 + rand() / (double) RAND_MAX * 3000000);
+                        printf("%d: done job\n", tid);
+                }
+
+                printf("[%d] leaving\n", tid);
+
+                /* this stops jobless thread from exiting early and killing workers */
+                #pragma omp barrier
+        }
+
+        return 0;
+}
diff --git a/Task/Checkpoint_synchronization/Go/checkpoint_synchronization.go b/Task/Checkpoint_synchronization/Go/checkpoint_synchronization.go
new file mode 100644
index 0000000000..a25040b737
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Go/checkpoint_synchronization.go
@@ -0,0 +1,68 @@
+package main
+
+import (
+    "log"
+    "math/rand"
+    "os"
+    "sync"
+    "time"
+)
+
+const nMech = 5
+const detailsPerMech = 4
+
+var l = log.New(os.Stdout, "", 0)
+
+func main() {
+    assemble := make(chan int)
+    var complete sync.WaitGroup
+
+    go solicit(assemble, &complete, nMech*detailsPerMech)
+
+    for i := 1; i <= nMech; i++ {
+        complete.Add(detailsPerMech)
+        for j := 0; j < detailsPerMech; j++ {
+            assemble <- 0
+        }
+        // Go checkpoint feature
+        complete.Wait()
+        // checkpoint reached
+        l.Println("mechanism", i, "completed")
+    }
+}
+
+func solicit(a chan int, c *sync.WaitGroup, nDetails int) {
+    rand.Seed(time.Now().UnixNano())
+    var id int // worker id, for output
+    for nDetails > 0 {
+        // some random time to find a worker
+        time.Sleep(time.Duration(5e8 + rand.Int63n(5e8)))
+        id++
+        // contract to assemble a certain number of details
+        contract := rand.Intn(5) + 1
+        if contract > nDetails {
+            contract = nDetails
+        }
+        dword := "details"
+        if contract == 1 {
+            dword = "detail"
+        }
+        l.Println("worker", id, "contracted to assemble", contract, dword)
+        go worker(a, c, contract, id)
+        nDetails -= contract
+    }
+}
+
+func worker(a chan int, c *sync.WaitGroup, contract, id int) {
+    // some random time it takes for this worker to assemble a detail
+    assemblyTime := time.Duration(5e8 + rand.Int63n(5e8))
+    l.Println("worker", id, "enters shop")
+    for i := 0; i < contract; i++ {
+        <-a
+        l.Println("worker", id, "assembling")
+        time.Sleep(assemblyTime)
+        l.Println("worker", id, "completed detail")
+        c.Done()
+    }
+    l.Println("worker", id, "leaves shop")
+}
diff --git a/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization-2.hs b/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization-2.hs
new file mode 100644
index 0000000000..969e5d0b56
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization-2.hs
@@ -0,0 +1,112 @@
+import Control.Concurrent
+import Control.Monad        -- needed for "forM", "forM_"
+
+-- (workers working, workers done, workers total)
+type Workshop = MVar (Int, Int, Int)
+-- list of IO actions to be performed by one worker
+type Actions = [IO ()]
+
+newWorkshop :: IO Workshop
+newWorkshop = newMVar (0, 0, 0)
+
+-- check point: workers wait here for the other workers to
+-- finish, before resuming execution/restarting
+checkPoint :: Workshop -> IO ()
+checkPoint w = do
+    (working, done, count) <- takeMVar w
+    -- all workers are done: reset counters and return (threads
+    -- resume execution or restart)
+    if working <= 0 && done == count
+    then do
+            putStrLn "---- Check Point"
+            putMVar w (0, 0, count)
+    -- mvar was just initialized: do nothing, just return.
+    -- otherwise, a race condition may arise
+    else if working == 0 && done == 0
+            then putMVar w (working, done, count)
+    -- workers are still working: wait for them (loop)
+    else do
+            putMVar w (working, done, count)
+            checkPoint w
+
+-- join the workshop
+addWorker :: Workshop -> ThreadId -> IO ()
+addWorker w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has joined the group."
+    putMVar w (working, done, count + 1)
+
+-- leave the workshop
+removeWorker :: Workshop -> ThreadId -> IO ()
+removeWorker w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has left the group."
+    putMVar w (working, done, count - 1)
+
+-- increase the number of workers doing something.
+-- optionally, print a message using the thread's ID
+startWork :: Workshop -> ThreadId -> IO ()
+startWork w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has started."
+    putMVar w (working + 1, done, count)
+
+-- decrease the number of workers doing something and increase the
+-- number of workers done. optionally, print a message using
+-- the thread's ID
+finishWork :: Workshop -> ThreadId -> IO ()
+finishWork w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " is ready."
+    putMVar w (working - 1, done + 1, count)
+
+-- put a worker to do his tasks. the steps are:
+-- 1. join the workshop "w"
+-- 2. report that the worker has started an action
+-- 3. perform one action
+-- 4. report that the worker is ready for the next action
+-- 5. wait for the other workers to finish
+-- 6. repeat from 2 until the worker has nothing more to do
+-- 7. leave the workshop
+worker :: Workshop -> Actions -> IO ()
+worker w actions = do
+    i <- myThreadId
+    addWorker w i
+    forM_ actions $ \action -> do
+        startWork w i
+        action
+        finishWork w i
+        checkPoint w
+    removeWorker w i
+
+-- launch several worker threads. their thread ID's are returned
+shop :: Workshop -> [Actions] -> IO [ThreadId]
+shop w actions = do
+    forM actions $ \x -> forkIO (worker w x)
+
+main = do
+    -- make a workshop
+    w <- newWorkshop
+
+    -- the workers won't be doing anything special, just wait for n
+    -- regular intervals. pids gathers the ID's of the threads
+
+    -- this are the first workers joining the workshop
+    pids1 <- shop w
+        [replicate 5 $ threadDelay 1300000
+        ,replicate 10 $ threadDelay 759191
+        ,replicate 7 $ threadDelay 965300]
+
+    -- wait for 5 secs before the next workers join
+    threadDelay 5000000
+
+    -- these are other workers that join the workshop later
+    pids2 <- shop w
+        [replicate 6 $ threadDelay 380000
+        ,replicate 4 $ threadDelay 250000]
+
+    -- wait for a key press
+    getChar
+
+    -- kill all worker threads before exit, if they're still running
+    forM_ (pids1 ++ pids2) killThread
diff --git a/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization.hs b/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization.hs
new file mode 100644
index 0000000000..8d99ca1bc3
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Haskell/checkpoint_synchronization.hs
@@ -0,0 +1,82 @@
+import Control.Parallel
+
+data Task a = Idle | Make a
+type TaskList a = [a]
+type Results a = [a]
+type TaskGroups a = [TaskList a]
+type WorkerList a = [Worker a]
+type Worker a = [Task a]
+
+-- run tasks in parallel and collect their results
+-- the function doesn't return until all tasks are done, therefore
+-- finished threads wait for the others to finish.
+runTasks :: TaskList a -> Results a
+runTasks [] = []
+runTasks (x:[]) = x : []
+runTasks (x:y:[]) = y `par` x : y : []
+runTasks (x:y:ys) = y `par` x : y : runTasks ys
+
+-- take a list of workers with different numbers of tasks and group
+-- them: first the first task of each worker, then the second one etc.
+groupTasks :: WorkerList a -> TaskGroups a
+groupTasks [] = []
+groupTasks xs
+    | allWorkersIdle xs = []
+    | otherwise =
+        concatMap extractTask xs : groupTasks (map removeTask xs)
+
+-- return a task as a plain value
+extractTask :: Worker a -> [a]
+extractTask [] = []
+extractTask (Idle:_) = []
+extractTask (Make a:_) = [a]
+
+-- remove the foremost task of each worker
+removeTask :: Worker a -> Worker a
+removeTask = drop 1
+
+-- checks whether all workers are idle in this task
+allWorkersIdle :: WorkerList a -> Bool
+allWorkersIdle = all null . map extractTask
+
+-- the workers must calculate big sums. the first sum of each worker
+-- belongs to the first task, and so on.
+-- because of laziness, nothing is computed yet.
+
+-- worker1 has 5 tasks to do
+worker1 :: Worker Integer
+worker1 = map Make [ sum [1..n*1000000] | n <- [1..5] ]
+
+-- worker2 has 4 tasks to do
+worker2 :: Worker Integer
+worker2 = map Make [ sum [1..n*100000] | n <- [1..4] ]
+
+-- worker3 has 3 tasks to do
+worker3 :: Worker Integer
+worker3 = map Make [ sum [1..n*1000000] | n <- [1..3] ]
+
+-- worker4 has 5 tasks to do
+worker4 :: Worker Integer
+worker4 = map Make [ sum [1..n*300000] | n <- [1..5] ]
+
+-- worker5 has 4 tasks to do, but starts at the second task.
+worker5 :: Worker Integer
+worker5 = [Idle] ++ map Make [ sum [1..n*400000] | n <- [1..4] ]
+
+-- group the workers' tasks
+tasks :: TaskGroups Integer
+tasks = groupTasks [worker1, worker2, worker3, worker4, worker5]
+
+-- a workshop: take a function to operate the results and a group of tasks,
+-- execute the tasks showing the process and process the results
+workshop :: (Show a, Num a, Show b, Num b) => ([a] -> b) -> [[a]] -> IO ()
+workshop func a = mapM_ doWork $ zip [1..length a] a
+    where
+        doWork (x, y) = do
+            putStrLn $ "Doing task " ++ show x ++ "."
+            putStrLn $ "There are " ++ show (length y) ++ " workers for this task."
+            putStrLn "Waiting for all workers..."
+            print $ func $ runTasks y
+            putStrLn $ "Task " ++ show x ++ " done."
+
+main = workshop sum tasks
diff --git a/Task/Checkpoint_synchronization/Java/checkpoint_synchronization-2.java b/Task/Checkpoint_synchronization/Java/checkpoint_synchronization-2.java
new file mode 100644
index 0000000000..c47975cc1b
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Java/checkpoint_synchronization-2.java
@@ -0,0 +1,48 @@
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+public class Sync {
+	static class Worker implements Runnable {
+		private final CountDownLatch doneSignal;
+		private int threadID;
+
+		public Worker(int id, CountDownLatch doneSignal) {
+			this.doneSignal = doneSignal;
+			threadID = id;
+		}
+
+		public void run() {
+			doWork();
+			doneSignal.countDown();
+		}
+
+		void doWork() {
+			try {
+				int workTime = new Random().nextInt(900) + 100;
+				System.out.println("Worker " + threadID + " will work for " + workTime + " msec.");
+				Thread.sleep(workTime); //work for 'workTime'
+				System.out.println("Worker " + threadID + " is ready");
+			} catch (InterruptedException e) {
+				System.err.println("Error: thread execution interrupted");
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void main(String[] args) {
+		int n = 3;//6 workers and 3 tasks
+		for(int task = 1; task <= n; task++) {
+			CountDownLatch latch = new CountDownLatch(n * 2);
+			System.out.println("Starting task " + task);
+			for(int worker = 0; worker < n * 2; worker++) {
+				new Thread(new Worker(worker, latch)).start();
+			}
+			try {
+				latch.await();//wait for n*2 threads to signal the latch
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+			System.out.println("Task " + task + " complete");
+		}
+	}
+}
diff --git a/Task/Checkpoint_synchronization/Java/checkpoint_synchronization.java b/Task/Checkpoint_synchronization/Java/checkpoint_synchronization.java
new file mode 100644
index 0000000000..ef360c361a
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Java/checkpoint_synchronization.java
@@ -0,0 +1,89 @@
+import java.util.Scanner;
+import java.util.Random;
+
+public class CheckpointSync{
+	public static void main(String[] args){
+		System.out.print("Enter number of workers to use: ");
+		Scanner in = new Scanner(System.in);
+		Worker.nWorkers = in.nextInt();
+		System.out.print("Enter number of tasks to complete:");
+		runTasks(in.nextInt());
+	}
+	
+	/*
+	 * Informs that workers started working on the task and
+	 * starts running threads. Prior to proceeding with next
+	 * task syncs using static Worker.checkpoint() method.
+	 */
+	private static void runTasks(int nTasks){
+		for(int i = 0; i < nTasks; i++){
+			System.out.println("Starting task number " + (i+1) + ".");
+			runThreads();
+			Worker.checkpoint();
+		}
+	}
+	
+	/*
+	 * Creates a thread for each worker and runs it.
+	 */
+	private static void runThreads(){
+		for(int i = 0; i < Worker.nWorkers; i ++){
+			new Thread(new Worker(i+1)).start();
+		}
+	}
+	
+	/*
+	 * Worker inner static class.
+	 */
+	public static class Worker implements Runnable{
+		public Worker(int threadID){
+			this.threadID = threadID;
+		}
+		public void run(){
+			work();
+		}
+		
+		/*
+		 *  Notifies that thread started running for 100 to 1000 msec.
+		 *  Once finished increments static counter 'nFinished'
+		 *  that counts number of workers finished their work.
+		 */
+		private synchronized void work(){
+			try {
+				int workTime = rgen.nextInt(900) + 100;
+				System.out.println("Worker " + threadID + " will work for " + workTime + " msec.");
+				Thread.sleep(workTime); //work for 'workTime'
+				nFinished++; //increases work finished counter
+				System.out.println("Worker " + threadID + " is ready");
+			} catch (InterruptedException e) {
+				System.err.println("Error: thread execution interrupted");
+				e.printStackTrace();
+			}
+		}
+		
+		/*
+		 * Used to synchronize Worker threads using 'nFinished' static integer.
+		 * Waits (with step of 10 msec) until 'nFinished' equals to 'nWorkers'.
+		 * Once they are equal resets 'nFinished' counter.
+		 */
+		public static synchronized void checkpoint(){
+			while(nFinished != nWorkers){
+				try {
+					Thread.sleep(10);
+				} catch (InterruptedException e) {
+					System.err.println("Error: thread execution interrupted");
+					e.printStackTrace();
+				}
+			}
+			nFinished = 0;
+		}
+	
+		/* inner class instance variables */
+		private int threadID;
+		
+		/* static variables */
+		private static Random rgen = new Random();
+		private static int nFinished = 0;
+		public static int nWorkers = 0;
+	}
+}
diff --git a/Task/Checkpoint_synchronization/Perl/checkpoint_synchronization.pl b/Task/Checkpoint_synchronization/Perl/checkpoint_synchronization.pl
new file mode 100644
index 0000000000..a92052dc06
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Perl/checkpoint_synchronization.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use v5.10;
+
+use Socket;
+
+my $nr_items = 3;
+
+sub short_sleep($) {
+    (my $seconds) = @_;
+    select undef, undef, undef, $seconds;
+}
+
+# This is run in a worker thread.  It repeatedly waits for a character from
+# the main thread, and sends a value back to the main thread.  A short
+# sleep introduces random timing, just to keep us honest.
+
+sub be_worker($$) {
+    my ($socket, $value) = @_;
+    for (1 .. $nr_items) {
+        sysread $socket, my $dummy, 1;
+        short_sleep rand 0.5;
+        syswrite $socket, $value;
+        ++$value;
+    }
+
+    exit;
+}
+
+# This function forks a worker and sends it a socket on which to talk to
+# the main thread, as well as an initial value to work with.  It returns
+# (to the main thread) a socket on which to talk to the worker.
+
+sub fork_worker($) {
+    (my $value) = @_;
+    socketpair my $kidsock, my $dadsock, AF_UNIX, SOCK_STREAM, PF_UNSPEC
+        or die "socketpair: $!";
+
+    if (fork // die "fork: $!") {
+        # We're the parent
+        close $dadsock;
+        return $kidsock;
+    }
+    else {
+        # We're the child
+        close $kidsock;
+        be_worker $dadsock, $value;
+        # Never returns
+    }
+}
+
+# Fork two workers, send them start signals, retrieve the values they send
+# back, and print them
+
+my $alpha_sock = fork_worker 'A';
+my $digit_sock = fork_worker 1;
+
+for (1 .. $nr_items) {
+    syswrite $_, 'x'   for $alpha_sock, $digit_sock;
+    sysread $alpha_sock, my $alpha, 1;
+    sysread $digit_sock, my $digit, 1;
+    say $alpha, $digit;
+}
+
+# If the main thread were planning to run for a long time after the
+# workers had terminate, it would need to reap them to avoid zombies:
+
+wait; wait;
diff --git a/Task/Checkpoint_synchronization/PicoLisp/checkpoint_synchronization.l b/Task/Checkpoint_synchronization/PicoLisp/checkpoint_synchronization.l
new file mode 100644
index 0000000000..919851b542
--- /dev/null
+++ b/Task/Checkpoint_synchronization/PicoLisp/checkpoint_synchronization.l
@@ -0,0 +1,19 @@
+(de checkpoints (Projects Workers)
+   (for P Projects
+      (prinl "Starting project number " P ":")
+      (for
+         (Staff
+            (mapcar
+               '((I) (worker (format I) (rand 2 5)))  # Create staff of workers
+               (range 1 Workers) )
+            Staff                                     # While still busy
+            (filter worker Staff) ) )                 # Remove finished workers
+      (prinl "Project number " P " is done.") ) )
+
+(de worker (ID Steps)
+   (co ID
+      (prinl "Worker " ID " has " Steps " steps to do")
+      (for N Steps
+         (yield ID)
+         (prinl "Worker " ID " step " N) )
+      NIL ) )
diff --git a/Task/Checkpoint_synchronization/Ruby/checkpoint_synchronization.rb b/Task/Checkpoint_synchronization/Ruby/checkpoint_synchronization.rb
new file mode 100644
index 0000000000..8319861307
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Ruby/checkpoint_synchronization.rb
@@ -0,0 +1,158 @@
+require 'socket'
+
+# A Workshop runs all of its workers, then collects their results. Use
+# Workshop#add to add workers and Workshop#work to run them.
+#
+# This implementation forks some processes to run the workers in
+# parallel. Ruby must provide Kernel#fork and 'socket' library must
+# provide UNIXSocket.
+#
+# Why processes and not threads? C Ruby still has a Global VM Lock,
+# where only one thread can hold the lock. One platform, OpenBSD, still
+# has userspace threads, with all threads on one cpu core. Multiple
+# processes will not compete for a single Global VM Lock and can run
+# on multiple cpu cores.
+class Workshop
+  # Creates a Workshop.
+  def initialize
+    @sockets = {}
+  end
+
+  # Adds a worker to this Workshop. Returns a worker id _wid_ for this
+  # worker. The worker is a block that takes some _args_ and returns
+  # some value. Workshop#work will run the block.
+  #
+  # This implementation forks a process for the worker. This process
+  # will use Marshal with UNIXSocket to receive the _args_ and to send
+  # the return value. The _wid_ is a process id. The worker also
+  # inherits _IO_ objects, which might be a problem if the worker holds
+  # open a pipe or socket, and the other end never reads EOF.
+  def add
+    child, parent = UNIXSocket.pair
+
+    wid = fork do
+      # I am the child.
+      child.close
+      @sockets.each_value { |sibling| sibling.close }
+
+      # Prevent that all the children print their backtraces (to a mess
+      # of mixed lines) when user presses Control-C.
+      Signal.trap("INT") { exit! }
+
+      loop do
+        # Wait for a command.
+        begin
+          command, args = Marshal.load(parent)
+        rescue EOFError
+          # Parent probably died.
+          break
+        end
+
+        case command
+        when :work
+          # Do work. Send result to parent.
+          result = yield *args
+          Marshal.dump(result, parent)
+        when :remove
+          break
+        else
+          fail "bad command from workshop"
+        end
+      end
+    end
+
+    # I am the parent.
+    parent.close
+    @sockets[wid] = child
+    wid
+  end
+
+  # Runs all of the workers, and collects the results in a Hash. Passes
+  # the same _args_ to each of the workers. Returns a Hash that pairs
+  # _wid_ => _result_, where _wid_ is the worker id and _result_ is the
+  # return value from the worker.
+  #
+  # This implementation runs the workers in parallel, and waits until
+  # _all_ of the workers finish their results. Workshop provides no way
+  # to start the work without waiting for the work to finish. If a
+  # worker dies (for example, by raising an Exception), then
+  # Workshop#work raises a RuntimeError.
+  def work(*args)
+    message = [:work, args]
+    @sockets.each_pair do |wid, child|
+      Marshal.dump(message, child)
+    end
+
+    # Checkpoint! Wait for all workers to finish.
+    result = {}
+    @sockets.each_pair do |wid, child|
+      begin
+        # This waits until the child finishes a result.
+        result[wid] = Marshal.load(child)
+      rescue EOFError
+        fail "Worker #{wid} died"
+      end
+    end
+    result
+  end
+
+  # Removes a worker from the Workshop, who has a worker id _wid_.
+  # If there is no such worker, raises ArgumentError.
+  #
+  # This implementation kills and reaps the process for the worker.
+  def remove(wid)
+    unless child = @sockets.delete(wid)
+      raise ArgumentError, "No worker #{wid}"
+    else
+      Marshal.dump([:remove, nil], child)
+      child.close
+      Process.wait(wid)
+    end
+  end
+end
+
+
+
+# First create a Workshop.
+require 'pp'
+shop = Workshop.new
+wids = []
+
+# Our workers must not use the same random numbers after the fork.
+@fixed_rand = false
+def fix_rand
+  unless @fixed_rand; srand; @fixed_rand = true; end
+end
+
+# Start with some workers.
+6.times do
+  wids << shop.add do |i|
+    # This worker slowly calculates a Fibonacci number.
+    fix_rand
+    f = proc { |n| if n < 2 then n else f[n - 1] + f[n - 2] end }
+    [i, f[25 + rand(10)]]
+  end
+end
+
+6.times do |i|
+  # Do one cycle of work, and print the result.
+  pp shop.work(i)
+
+  # Remove a worker.
+  victim = rand(wids.length)
+  shop.remove wids[victim]
+  wids.slice! victim
+
+  # Add another worker.
+  wids << shop.add do |j|
+    # This worker slowly calculates a number from
+    # the sequence 0, 1, 2, 3, 6, 11, 20, 37, 68, 125, ...
+    fix_rand
+    f = proc { |n| if n < 3 then n else f[n - 1] + f[n - 2] + f[n - 3] end }
+    [j, i, f[20 + rand(10)]]
+  end
+end
+
+# Remove all workers.
+wids.each { |wid| shop.remove wid }
+pp shop.work(6)
diff --git a/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization-2.tcl b/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization-2.tcl
new file mode 100644
index 0000000000..52b7071c13
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization-2.tcl
@@ -0,0 +1,30 @@
+# Build the workers
+foreach worker {A B C D} {
+    dict set ids $worker [checkpoint makeThread {
+	proc task {name} {
+	    checkpoint join
+	    set deadline [expr {[clock seconds] + 2}]
+	    while {[clock seconds] <= $deadline} {
+		puts "$name is working"
+		after [expr {int(500 * rand())}]
+		puts "$name is ready"
+		checkpoint deliver
+	    }
+	    checkpoint leave
+	    thread::release; # Ask the thread to finish
+	}
+    }]
+}
+
+# Set them all processing in the background
+dict for {name id} $ids {
+    thread::send -async $id "task $name"
+}
+
+# Wait until all tasks are done (i.e., they have unregistered)
+while 1 {
+    after 100 set s 1; vwait s; # Process events for 100ms
+    if {![checkpoint anyJoined]} {
+	break
+    }
+}
diff --git a/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization.tcl b/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization.tcl
new file mode 100644
index 0000000000..d19c1a4585
--- /dev/null
+++ b/Task/Checkpoint_synchronization/Tcl/checkpoint_synchronization.tcl
@@ -0,0 +1,97 @@
+package require Tcl 8.5
+package require Thread
+
+namespace eval checkpoint {
+    namespace export {[a-z]*}
+    namespace ensemble create
+    variable members {}
+    variable waiting {}
+    variable event
+    # Back-end of join operation
+    proc Join {id} {
+	variable members
+	variable counter
+	if {$id ni $members} {
+	    lappend members $id
+	}
+	return $id
+    }
+    # Back-end of leave operation
+    proc Leave {id} {
+	variable members
+	set idx [lsearch -exact $members $id]
+	if {$idx > -1} {
+	    set members [lreplace $members $idx $idx]
+	    variable event
+	    if {![info exists event]} {
+		set event [after idle ::checkpoint::Release]
+	    }
+	}
+	return
+    }
+    # Back-end of deliver operation
+    proc Deliver {id} {
+	variable waiting
+	lappend waiting $id
+
+	variable event
+	if {![info exists event]} {
+	    set event [after idle ::checkpoint::Release]
+	}
+	return
+    }
+    # Releasing is done as an "idle" action to prevent deadlocks
+    proc Release {} {
+	variable members
+	variable waiting
+	variable event
+	unset event
+	if {[llength $members] != [llength $waiting]} return
+	set w $waiting
+	set waiting {}
+	foreach id $w {
+	    thread::send -async $id {incr ::checkpoint::Delivered}
+	}
+    }
+
+    # Make a thread and attach it to the public API of the checkpoint
+    proc makeThread {{script ""}} {
+	set id [thread::create thread::wait]
+	thread::send $id {
+	    namespace eval checkpoint {
+		namespace export {[a-z]*}
+		namespace ensemble create
+
+		# Call to actually join the checkpoint group
+		proc join {} {
+		    variable checkpoint
+		    thread::send $checkpoint [list \
+			    ::checkpoint::Join [thread::id]]
+		}
+		# Call to actually leave the checkpoint group
+		proc leave {} {
+		    variable checkpoint
+		    thread::send $checkpoint [list \
+			    ::checkpoint::Leave [thread::id]]
+		}
+		# Call to wait for checkpoint synchronization
+		proc deliver {} {
+		    variable checkpoint
+		    # Do this from within the [vwait] to ensure that we're already waiting
+		    after 0 [list thread::send $checkpoint [list \
+			    ::checkpoint::Deliver [thread::id]]]
+		    vwait ::checkpoint::Delivered
+		}
+	    }
+	}
+	thread::send $id [list set ::checkpoint::checkpoint [thread::id]]
+	thread::send $id $script
+	return $id
+    }
+
+    # Utility to help determine whether the checkpoint is in use
+    proc anyJoined {} {
+	variable members
+	expr {[llength $members] > 0}
+    }
+}
diff --git a/Task/Classes/0DESCRIPTION b/Task/Classes/0DESCRIPTION
new file mode 100644
index 0000000000..916fffc8da
--- /dev/null
+++ b/Task/Classes/0DESCRIPTION
@@ -0,0 +1,14 @@
+In [[object-oriented programming]] '''class''' is a set (a [[wp:Transitive_closure|transitive closure]]) of types bound by the relation of [[inheritance]]. It is said that all types derived from some base type T and the type T itself form a class T. The first type T from the class T sometimes is called the '''root type''' of the class.
+
+A class of types itself, as a type, has the values and operations of its own. The operations of are usually called '''methods''' of the root type. Both operations and values are called [[polymorphism | polymorphic]].
+
+A polymorphic operation (method) selects an implementation depending on the actual specific type of the polymorphic argument. The action of choice the type-specific implementation of a polymorphic operation is called '''dispatch'''. Correspondingly, polymorphic operations are often called '''dispatching''' or '''virtual'''. Operations with multiple arguments and/or the results of the class are called '''multi-methods'''. A further generalization of is the operation with arguments and/or results from different classes.
+
+* single-dispatch languages are those that allow only one argument or result to control the dispatch. Usually it is the first parameter, often hidden, so that a prefix notation ''x''.''f''() is used instead of mathematical ''f''(''x'').
+* multiple-dispatch languages allow many arguments and/or results to control the dispatch.
+
+A polymorphic value has a type tag indicating its specific type from the class and the corresponding specific value of that type. This type is sometimes called '''the most specific type''' of a [polymorphic] value. The type tag of the value is used in order to resolve the dispatch. The set of polymorphic values of a class is a transitive closure of the sets of values of all types from that class.
+
+In many [[object-oriented programming | OO]] languages the type of the class of T and T itself are considered equivalent. In some languages they are distinct (like in [[Ada]]). When class T and T are equivalent, there is no way to distinguish polymorphic and specific values.
+
+The purpose of this task is to create a basic class with a method, a constructor, an instance variable and how to instantiate it.
diff --git a/Task/Classes/1META.yaml b/Task/Classes/1META.yaml
new file mode 100644
index 0000000000..ac1bfa4979
--- /dev/null
+++ b/Task/Classes/1META.yaml
@@ -0,0 +1,6 @@
+---
+category:
+- Object oriented
+- Type System
+- Encyclopedia
+note: Basic language learning
diff --git a/Task/Classes/ActionScript/classes.as b/Task/Classes/ActionScript/classes.as
new file mode 100644
index 0000000000..7f27b423a1
--- /dev/null
+++ b/Task/Classes/ActionScript/classes.as
@@ -0,0 +1,21 @@
+package {
+    public class MyClass {
+
+        private var myVariable:int;  // Note: instance variables are usually "private"
+
+        /**
+         * The constructor
+         */
+        public function MyClass() {
+            // creates a new instance
+        }
+
+        /**
+         * A method
+         */
+        public function someMethod():void {
+            this.myVariable = 1; // Note: "this." is optional
+            // myVariable = 1; works also
+        }
+    }
+}
diff --git a/Task/Classes/BASIC/classes.bas b/Task/Classes/BASIC/classes.bas
new file mode 100644
index 0000000000..a2b5acbb2d
--- /dev/null
+++ b/Task/Classes/BASIC/classes.bas
@@ -0,0 +1,19 @@
+  DECLARE SUB MyClassDelete (pthis AS MyClass)
+  DECLARE SUB MyClassSomeMethod (pthis AS MyClass)
+  DECLARE SUB MyClassInit (pthis AS MyClass)
+
+  TYPE MyClass
+    Variable AS INTEGER
+  END TYPE
+
+  DIM obj AS MyClass
+  MyClassInit obj
+  MyClassSomeMethod obj
+
+  SUB MyClassInit (pthis AS MyClass)
+    pthis.Variable = 0
+  END SUB
+
+  SUB MyClassSomeMethod (pthis AS MyClass)
+    pthis.Variable = 1
+  END SUB
diff --git a/Task/Classes/C/classes.c b/Task/Classes/C/classes.c
new file mode 100644
index 0000000000..0d98c78fc9
--- /dev/null
+++ b/Task/Classes/C/classes.c
@@ -0,0 +1,30 @@
+typedef struct sMyClass
+{
+  int variable;
+} *MyClass;
+
+MyClass  MyClass_new()
+{
+  MyClass pthis = malloc( sizeof(struct sMyClass) );
+  //memset(pthis, 0, sizeof(struct sMyClass) );
+  pthis->variable = 0;
+  return pthis;
+}
+
+void MyClass_delete(MyClass* pthis)
+{
+  if(pthis && *pthis)
+  {
+    free(*pthis);
+    *pthis = NULL;
+  }
+}
+
+void MyClass_someMethod(MyClass pthis)
+{
+  pthis->variable = 1;
+}
+
+MyClass obj = MyClass_new();
+MyClass_someMethod(obj);
+MyClass_delete(&obj);
diff --git a/Task/Classes/CoffeeScript/classes.coffee b/Task/Classes/CoffeeScript/classes.coffee
new file mode 100644
index 0000000000..84a69d9c51
--- /dev/null
+++ b/Task/Classes/CoffeeScript/classes.coffee
@@ -0,0 +1,14 @@
+# Create a basic class
+class Rectangle
+  # Constructor that accepts one argument
+  constructor: (@width) ->
+
+  # An instance variable
+  length: 10
+
+  # A method
+  area: () ->
+    @width * @length
+
+# Instantiate the class using the new operator
+rect = new Rectangle 2
diff --git a/Task/Classes/Forth/classes-2.fth b/Task/Classes/Forth/classes-2.fth
new file mode 100644
index 0000000000..a4360ae308
--- /dev/null
+++ b/Task/Classes/Forth/classes-2.fth
@@ -0,0 +1 @@
+MyClass newInstance
diff --git a/Task/Classes/Forth/classes-3.fth b/Task/Classes/Forth/classes-3.fth
new file mode 100644
index 0000000000..8bdf71d271
--- /dev/null
+++ b/Task/Classes/Forth/classes-3.fth
@@ -0,0 +1 @@
+New> MyClass  value newInstance
diff --git a/Task/Classes/Forth/classes-4.fth b/Task/Classes/Forth/classes-4.fth
new file mode 100644
index 0000000000..e24a7efb97
--- /dev/null
+++ b/Task/Classes/Forth/classes-4.fth
@@ -0,0 +1,2 @@
+10 set: newInstance
+show: newInstance
diff --git a/Task/Classes/Forth/classes-5.fth b/Task/Classes/Forth/classes-5.fth
new file mode 100644
index 0000000000..18b2236d64
--- /dev/null
+++ b/Task/Classes/Forth/classes-5.fth
@@ -0,0 +1,2 @@
+newInstance dispose
+0 to newInstance   \ no dangling pointers!
diff --git a/Task/Classes/Forth/classes-6.fth b/Task/Classes/Forth/classes-6.fth
new file mode 100644
index 0000000000..c718397dd0
--- /dev/null
+++ b/Task/Classes/Forth/classes-6.fth
@@ -0,0 +1,5 @@
+: test { \ obj -- }
+    New> MyClass to obj
+      show: obj
+      1000 set: obj
+    obj dispose ;
diff --git a/Task/Classes/Forth/classes.fth b/Task/Classes/Forth/classes.fth
new file mode 100644
index 0000000000..e378b68e46
--- /dev/null
+++ b/Task/Classes/Forth/classes.fth
@@ -0,0 +1,14 @@
+:class MyClass  1 && b.corkscrew
+}
+
+// a "constructor."
+// Also in quotes as Go does not have that exact mechanism as part of the
+// language.  A common idiom however, is a function with the name new,
+// that returns a new object of the type, fully initialized as needed and
+// ready to use.  It makes sense to use this kind of constructor function when
+// non-trivial initialization is needed.  In cases where the concise syntax
+// shown is sufficient however, it is not idiomatic to define the function.
+// Rather, code that needs a new object would simply contain &picnicBasket{...
+func newPicnicBasket(nPeople int) *picnicBasket {
+    // arbitrary code to interpret arguments, check resources, etc.
+    // ...
+    // return data new object.
+    // this is the concise syntax.  there are other ways of doing it.
+    return &picnicBasket{nPeople, nPeople > 0}
+}
+
+// how to instantiate it.
+func main() {
+    var pb picnicBasket          // create on stack (probably)
+    pbl := picnicBasket{}        // equivalent to above
+    pbp := &picnicBasket{}       // create on heap.  pbp is pointer to object.
+    pbn := new(picnicBasket)     // equivalent to above
+    forTwo := newPicnicBasket(2) // using constructor
+    // equivalent to above.  field names, called keys, are optional.
+    forToo := &picnicBasket{nServings: 2, corkscrew: true}
+
+    fmt.Println(pb.nServings, pb.corkscrew)
+    fmt.Println(pbl.nServings, pbl.corkscrew)
+    fmt.Println(pbp)
+    fmt.Println(pbn)
+    fmt.Println(forTwo)
+    fmt.Println(forToo)
+}
diff --git a/Task/Classes/Haskell/classes-2.hs b/Task/Classes/Haskell/classes-2.hs
new file mode 100644
index 0000000000..a9f034f291
--- /dev/null
+++ b/Task/Classes/Haskell/classes-2.hs
@@ -0,0 +1,23 @@
+data Shape = Rectangle Double Double | Circle Double
+{- This Shape is a type rather than a type class. Rectangle and
+Circle are its constructors. -}
+
+perimeter :: Shape -> Double
+{- An ordinary function, not a method. -}
+perimeter (Rectangle width height) = 2 * width + 2 * height
+perimeter (Circle radius)          = 2 * pi * radius
+
+area :: Shape -> Double
+area (Rectangle width height) = width * height
+area (Circle radius)          = pi * radius^2
+
+apRatio :: Shape -> Double
+{- Technically, this version of apRatio is monomorphic. -}
+apRatio shape = area shape / perimeter shape
+
+main = do
+    print $ apRatio $ Circle 5
+    print $ apRatio $ Rectangle 5 5
+{- The value returned by apRatio is determined by the return values
+of area and perimeter, which just happen to be defined differently
+for Rectangles and Circles. -}
diff --git a/Task/Classes/Haskell/classes-3.hs b/Task/Classes/Haskell/classes-3.hs
new file mode 100644
index 0000000000..cc84477fdb
--- /dev/null
+++ b/Task/Classes/Haskell/classes-3.hs
@@ -0,0 +1,21 @@
+class Example (x) # 'x' is a field in class
+
+  # method definition
+  method double ()
+    return 2 * x
+  end
+
+  # 'initially' block is called on instance construction
+  initially (x)
+    if /x # if x is null (not given), then set field to 0
+      then self.x := 0
+      else self.x := x
+end
+
+procedure main ()
+  x1 := Example ()  # new instance with default value of x
+  x2 := Example (2) # new instance with given value of x
+  write (x1.x)
+  write (x2.x)
+  write (x2.double ()) # call a method
+end
diff --git a/Task/Classes/Haskell/classes.hs b/Task/Classes/Haskell/classes.hs
new file mode 100644
index 0000000000..3c8cc8347f
--- /dev/null
+++ b/Task/Classes/Haskell/classes.hs
@@ -0,0 +1,33 @@
+class Shape a where
+    perimeter :: a -> Double
+    area      :: a -> Double
+{- A type class Shape. Types belonging to Shape must support two
+methods, perimeter and area. -}
+
+data Rectangle = Rectangle Double Double
+{- A new type with a single constructor. In the case of data types
+which have only one constructor, we conventionally give the
+constructor the same name as the type, though this isn't mandatory. -}
+
+data Circle = Circle Double
+
+instance Shape Rectangle where
+    perimeter (Rectangle width height) = 2 * width + 2 * height
+    area      (Rectangle width height) = width * height
+{- We made Rectangle an instance of the Shape class by
+implementing perimeter, area :: Rectangle -> Int. -}
+
+instance Shape Circle where
+    perimeter (Circle radius) = 2 * pi * radius
+    area      (Circle radius) = pi * radius^2
+
+apRatio :: Shape a => a -> Double
+{- A simple polymorphic function. -}
+apRatio shape = area shape / perimeter shape
+
+main = do
+    print $ apRatio $ Circle 5
+    print $ apRatio $ Rectangle 5 5
+{- The correct version of apRatio (and hence the correct
+implementations of perimeter and area) is chosen based on the type
+of the argument. -}
diff --git a/Task/Classes/Java/classes.java b/Task/Classes/Java/classes.java
new file mode 100644
index 0000000000..62456424fc
--- /dev/null
+++ b/Task/Classes/Java/classes.java
@@ -0,0 +1,19 @@
+public class MyClass {
+
+  // instance variable
+  private int variable;  // Note: instance variables are usually "private"
+
+  /**
+  * The constructor
+  */
+  public MyClass() {
+    // creates a new instance
+  }
+
+  /**
+  * A method
+  */
+  public void someMethod() {
+   this.variable = 1;
+  }
+}
diff --git a/Task/Classes/JavaScript/classes.js b/Task/Classes/JavaScript/classes.js
new file mode 100644
index 0000000000..20f6304c7b
--- /dev/null
+++ b/Task/Classes/JavaScript/classes.js
@@ -0,0 +1,24 @@
+//Constructor function.
+function Car(brand, weight) {
+  this.brand = brand;
+  this.weight = weight || 1000; // Resort to default value (with 'or' notation).
+}
+Car.prototype.getPrice = function() { // Method of Car.
+  return this.price;
+}
+
+function Truck(brand, size) {
+  this.car = Car;
+  this.car(brand, 2000); // Call another function, modifying the "this" object (e.g. "superconstructor".)
+  this.size = size; // Custom property for just this object.
+}
+Truck.prototype = Car.prototype; // Also "import" the prototype from Car.
+
+var cars = [ // Some example car objects.
+  new Car("Mazda"),
+  new Truck("Volvo", 2)
+];
+for (var i=0; i3
+
+instance:setvar(6)
+
+print(instance.var) -->6
diff --git a/Task/Classes/PHP/classes.php b/Task/Classes/PHP/classes.php
new file mode 100644
index 0000000000..3af53a985a
--- /dev/null
+++ b/Task/Classes/PHP/classes.php
@@ -0,0 +1,12 @@
+class MyClass {
+    public static $classVar;
+    public $instanceVar; // can also initialize it here
+    function __construct() {
+        $this->instanceVar = 0;
+    }
+    function someMethod() {
+        $this->instanceVar = 1;
+        self::$classVar = 3;
+    }
+}
+$myObj = new MyClass();
diff --git a/Task/Classes/Perl/classes-2.pl b/Task/Classes/Perl/classes-2.pl
new file mode 100644
index 0000000000..fd5b2f4576
--- /dev/null
+++ b/Task/Classes/Perl/classes-2.pl
@@ -0,0 +1,12 @@
+{
+    package MyClass;
+    use Moose;
+
+    has 'variable' => (is => 'rw', default => 0);
+    # constructor and accessor methods are added automatically
+
+    sub some_method {
+        my $self = shift;
+        $self->variable(1);
+    }
+}
diff --git a/Task/Classes/Perl/classes-3.pl b/Task/Classes/Perl/classes-3.pl
new file mode 100644
index 0000000000..29e9044091
--- /dev/null
+++ b/Task/Classes/Perl/classes-3.pl
@@ -0,0 +1,7 @@
+use MooseX::Declare;
+class MyClass {
+    has 'variable' => (is => 'rw', default => 0);
+    method some_method {
+        $self->variable(1);
+    }
+}
diff --git a/Task/Classes/Perl/classes-4.pl b/Task/Classes/Perl/classes-4.pl
new file mode 100644
index 0000000000..3cd6746378
--- /dev/null
+++ b/Task/Classes/Perl/classes-4.pl
@@ -0,0 +1,4 @@
+my $instance = MyClass->new;    # invoke constructor method
+
+$instance->some_method;    # invoke method on object instance
+ # instance deallocates when the last reference falls out of scope
diff --git a/Task/Classes/Perl/classes.pl b/Task/Classes/Perl/classes.pl
new file mode 100644
index 0000000000..eeb9dc0234
--- /dev/null
+++ b/Task/Classes/Perl/classes.pl
@@ -0,0 +1,19 @@
+{
+     # a class is a package (i.e. a namespace) with methods in it
+    package MyClass;
+
+     # a constructor is a function that returns a blessed reference
+    sub new {
+        my $class = shift;
+        bless {variable => 0}, $class;
+         # the instance object is a hashref in disguise.
+         # (it can be a ref to anything.)
+    }
+
+     # an instance method is a function that takes an object as first argument.
+     # the -> invocation syntax takes care of that nicely, see Usage paragraph below.
+    sub some_method {
+        my $self = shift;
+        $self->{variable} = 1;
+    }
+}
diff --git a/Task/Classes/PicoLisp/classes.l b/Task/Classes/PicoLisp/classes.l
new file mode 100644
index 0000000000..414335aeb3
--- /dev/null
+++ b/Task/Classes/PicoLisp/classes.l
@@ -0,0 +1,8 @@
+(class +Rectangle)
+# dx dy
+
+(dm area> ()  # Define a a method that calculates the rectangle's area
+   (* (: dx) (: dy)) )
+
+(println  # Create a rectangle, and print its area
+   (area> (new '(+Rectangle) 'dx 3 'dy 4)) )
diff --git a/Task/Classes/Python/classes-2.py b/Task/Classes/Python/classes-2.py
new file mode 100644
index 0000000000..ffa40e2d6c
--- /dev/null
+++ b/Task/Classes/Python/classes-2.py
@@ -0,0 +1,2 @@
+class MyClass(object):
+    ...
diff --git a/Task/Classes/Python/classes.py b/Task/Classes/Python/classes.py
new file mode 100644
index 0000000000..af2f399327
--- /dev/null
+++ b/Task/Classes/Python/classes.py
@@ -0,0 +1,38 @@
+class MyClass:
+    name2 = 2 # Class attribute
+
+    def __init__(self):
+        """
+        Constructor  (Technically an initializer rather than a true "constructor")
+        """
+        self.name1 = 0 # Instance attribute
+
+    def someMethod(self):
+        """
+        Method
+        """
+        self.name1 = 1
+        MyClass.name2 = 3
+
+
+myclass = MyClass() # class name, invoked as a function is the constructor syntax.
+
+class MyOtherClass:
+    count = 0  # Population of "MyOtherClass" objects
+    def __init__(self, name, gender="Male", age=None):
+        """
+        One initializer required, others are optional (with different defaults)
+        """
+        MyOtherClass.count += 1
+        self.name = name
+        self.gender = gender
+        if age is not None:
+            self.age = age
+    def __del__(self):
+        MyOtherClass.count -= 1
+
+person1 = MyOtherClass("John")
+print person1.name, person1.gender  # "John Male"
+print person1.age                   # Raises AttributeError exception!
+person2 = MyOtherClass("Jane", "Female", 23)
+print person2.name, person2.gender, person2.age  # "Jane Female 23"
diff --git a/Task/Classes/R/classes-2.r b/Task/Classes/R/classes-2.r
new file mode 100644
index 0000000000..f44e4d7d64
--- /dev/null
+++ b/Task/Classes/R/classes-2.r
@@ -0,0 +1,24 @@
+setClass("circle",
+   representation(
+      radius="numeric",
+      centre="numeric"),
+   prototype(
+      radius=1,
+      centre=c(0,0)))
+#Instantiate class with some arguments
+circS4 <- new("circle", radius=5.5)
+#Set other data slots (properties)
+circS4@centre <- c(3,4.2)
+
+#Define a method
+setMethod("plot", #signature("circle"),
+   signature(x="circle", y="missing"),
+   function(x, ...)
+   {
+      t <- seq(0, 2*pi, length.out=200)
+      #Note the use of @ instead of $
+      plot(x@centre[1] + x@radius*cos(t),
+         x@centre[2] + x@radius*sin(t),
+         type="l", ...)
+   })
+plot(circS4)
diff --git a/Task/Classes/R/classes.r b/Task/Classes/R/classes.r
new file mode 100644
index 0000000000..d3477fc0a4
--- /dev/null
+++ b/Task/Classes/R/classes.r
@@ -0,0 +1,13 @@
+#You define a class simply by setting the class attribute of an object
+circS3 <- list(radius=5.5, centre=c(3, 4.2))
+class(circS3) <- "circle"
+
+#plot is a generic function, so we can define a class specific method by naming it plot.classname
+plot.circle <- function(x, ...)
+{
+   t <- seq(0, 2*pi, length.out=200)
+   plot(x$centre[1] + x$radius*cos(t),
+      x$centre[2] + x$radius*sin(t),
+      type="l", ...)
+}
+plot(circS3)
diff --git a/Task/Classes/Racket/classes.rkt b/Task/Classes/Racket/classes.rkt
new file mode 100644
index 0000000000..720dc1a5b7
--- /dev/null
+++ b/Task/Classes/Racket/classes.rkt
@@ -0,0 +1,15 @@
+#lang racket
+
+(define fish%
+  (class object%
+    (super-new)
+
+    ;; an instance variable & constructor argument
+    (init-field size)
+
+    ;; a new method
+    (define/public (eat)
+      (displayln "gulp!"))))
+
+;; constructing an instance
+(new fish% [size 50])
diff --git a/Task/Classes/Ruby/classes.rb b/Task/Classes/Ruby/classes.rb
new file mode 100644
index 0000000000..92ca5d16ef
--- /dev/null
+++ b/Task/Classes/Ruby/classes.rb
@@ -0,0 +1,26 @@
+class MyClass
+  @@class_var = []
+
+  def initialize
+    # 'initialize' is the constructor method invoked during 'MyClass.new'
+    @instance_var = 0
+  end
+
+  def some_method
+    @instance_var = 1
+    @@class_var << Time.now
+  end
+
+  def self.class_method
+    # ...
+  end
+
+  # another way to define class methods: define an instance method in this class object's singleton class
+  class << self
+    def another_class_method
+      # ...
+    end
+  end
+end
+
+myclass = MyClass.new
diff --git a/Task/Classes/Sather/classes-2.sa b/Task/Classes/Sather/classes-2.sa
new file mode 100644
index 0000000000..3b7ba8b275
--- /dev/null
+++ b/Task/Classes/Sather/classes-2.sa
@@ -0,0 +1,12 @@
+class MAIN is
+  main is
+    test ::= #CLASSTEST(1, 2, 3);
+    -- the previous line is syntactic sugar for
+    -- test :CLASSTEST := CLASSTEST::create(1, 2, 3);
+    #OUT + test.z + "\n"; -- we can access z
+    test.z := 25;         -- we can set z
+    #OUT + test.x + "\n"; -- we can get x
+    -- test.x := 5;          -- we cannot set x
+    #OUT + test.getPrivateY(0) + "\n";
+  end;
+end;
diff --git a/Task/Classes/Sather/classes.sa b/Task/Classes/Sather/classes.sa
new file mode 100644
index 0000000000..a67de05839
--- /dev/null
+++ b/Task/Classes/Sather/classes.sa
@@ -0,0 +1,21 @@
+class CLASSTEST is
+  readonly attr x:INT; -- give a public getter, not a setter
+  private attr y:INT;  -- no getter, no setter
+  attr z:INT;          -- getter and setter
+
+  -- constructor
+  create(x, y, z:INT):CLASSTEST is
+    res :CLASSTEST := new; -- or res ::= new
+    res.x := x;
+    res.y := y;
+    res.z := z;
+    return res;
+  end;
+
+  -- a getter for the private y summed to s
+  getPrivateY(s:INT):INT is
+    -- y is not shadowed so we can write y instead of
+    -- self.y
+    return y + s;
+  end;
+end;
diff --git a/Task/Classes/Scala/classes.scala b/Task/Classes/Scala/classes.scala
new file mode 100644
index 0000000000..afbf734617
--- /dev/null
+++ b/Task/Classes/Scala/classes.scala
@@ -0,0 +1,19 @@
+/**
+ * This class implicitly includes a constructor which accepts an int and
+ * creates "val variable1: Int" with that value.
+ */
+class MyClass(variable1: Int) {
+    var variable2 = "asdf" // Another instance variable; a var this time
+    def this() = this(0) // An auxilliary constructor that instantiates with a default value
+    def myMethod = variable1 // A getter for variable1
+}
+
+/**
+ * Demonstrate use of our example class.
+ */
+object Main extends Application {
+    val m = new MyClass()
+    val n = new MyClass(3)
+    println(m.myMethod) // prints 0
+    println(n.myMethod) // prints 3
+}
diff --git a/Task/Classes/Scheme/classes.ss b/Task/Classes/Scheme/classes.ss
new file mode 100644
index 0000000000..ece399d954
--- /dev/null
+++ b/Task/Classes/Scheme/classes.ss
@@ -0,0 +1,14 @@
+  (define (withdraw amount)
+    (if (>= balance amount)
+        (begin (set! balance (- balance amount))
+               balance)
+        "Insufficient funds"))
+  (define (deposit amount)
+    (set! balance (+ balance amount))
+    balance)
+  (define (dispatch m)
+    (cond ((eq? m 'withdraw) withdraw)
+          ((eq? m 'deposit) deposit)
+          (else (error "Unknown request -- MAKE-ACCOUNT"
+                       m))))
+  dispatch)
diff --git a/Task/Classes/Smalltalk/classes.st b/Task/Classes/Smalltalk/classes.st
new file mode 100644
index 0000000000..214ce9e90d
--- /dev/null
+++ b/Task/Classes/Smalltalk/classes.st
@@ -0,0 +1,15 @@
+Object subclass: #MyClass
+  instanceVariableNames: 'instanceVar'
+  classVariableNames: 'classVar'
+  poolDictionaries: ''
+  category: 'Testing' !
+
+!MyClass class methodsFor: 'instance creation'!
+new
+  ^self basicNew  instanceVar := 0 ! !
+
+!MyClass methodsFor: 'testing'!
+someMethod
+  ^self instanceVar = 1; classVar = 3 ! !
+
+MyClass new someMethod!
diff --git a/Task/Classes/Tcl/classes.tcl b/Task/Classes/Tcl/classes.tcl
new file mode 100644
index 0000000000..5c782af39a
--- /dev/null
+++ b/Task/Classes/Tcl/classes.tcl
@@ -0,0 +1,22 @@
+package require TclOO
+oo::class create summation {
+    variable v
+    constructor {} {
+        set v 0
+    }
+    method add x {
+        incr v $x
+    }
+    method value {} {
+        return $v
+    }
+    destructor {
+        puts "Ended with value $v"
+    }
+}
+set sum [summation new]
+puts "Start with [$sum value]"
+for {set i 1} {$i <= 10} {incr i} {
+    puts "Add $i to get [$sum add $i]"
+}
+$sum destroy
diff --git a/Task/Closest-pair_problem/0DESCRIPTION b/Task/Closest-pair_problem/0DESCRIPTION
new file mode 100644
index 0000000000..a633dddc33
--- /dev/null
+++ b/Task/Closest-pair_problem/0DESCRIPTION
@@ -0,0 +1,63 @@
+{{Wikipedia|Closest pair of points problem}}
+The aim of this task is to provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the [[wp:Closest pair of points problem|Closest pair of points problem]] in the ''planar'' case.
+
+The straightforward solution is a O(n2) algorithm (which we can call ''brute-force algorithm''); the pseudocode (using indexes) could be simply:
+
+ '''bruteForceClosestPair''' of P(1), P(2), ... P(N)
+ '''if''' N < 2 '''then'''
+   '''return''' ∞
+ '''else'''
+   minDistance ← |P(1) - P(2)|
+   minPoints ← { P(1), P(2) }
+   '''foreach''' i ∈ [1, N-1]
+     '''foreach''' j ∈ [i+1, N]
+       '''if''' |P(i) - P(j)| < minDistance '''then'''
+         minDistance ← |P(i) - P(j)|
+         minPoints ← { P(i), P(j) }
+       '''endif'''
+     '''endfor'''
+   '''endfor'''
+   '''return''' minDistance, minPoints
+  '''endif'''
+
+A better algorithm is based on the recursive divide&conquer approach, as explained also at [[wp:Closest pair of points problem#Planar_case|Wikipedia]], which is O(''n'' log ''n''); a pseudocode could be:
+
+ '''closestPair''' of (xP, yP)
+                where xP is P(1) .. P(N) sorted by x coordinate, and
+                      yP is P(1) .. P(N) sorted by y coordinate (ascending order)
+ '''if''' N ≤ 3 '''then'''
+   '''return''' closest points of xP using brute-force algorithm
+ '''else'''
+   xL ← points of xP from 1 to ⌈N/2⌉
+   xR ← points of xP from ⌈N/2⌉+1 to N
+   xm ← xP(⌈N/2⌉)x
+   yL ← { p ∈ yP : px ≤ xm }
+   yR ← { p ∈ yP : px > xm }
+   (dL, pairL) ← ''closestPair'' of (xL, yL)
+   (dR, pairR) ← ''closestPair'' of (xR, yR)
+   (dmin, pairMin) ← (dR, pairR)
+   '''if''' dL < dR '''then'''
+     (dmin, pairMin) ← (dL, pairL)
+   '''endif'''
+   yS ← { p ∈ yP : |xm - px| < dmin }
+   nS ← number of points in yS
+   (closest, closestPair) ← (dmin, pairMin)
+   '''for''' i '''from''' 1 '''to''' nS - 1
+     k ← i + 1
+     '''while''' k ≤ nS '''and''' yS(k)y - yS(i)y < dmin
+       '''if''' |yS(k) - yS(i)| < closest '''then'''
+         (closest, closestPair) ← (|yS(k) - yS(i)|, {yS(k), yS(i)})
+       '''endif'''
+       k ← k + 1
+     '''endwhile'''
+   '''endfor'''
+   '''return''' closest, closestPair
+ '''endif'''
+
+
+'''References and further readings'''
+* [[wp:Closest pair of points problem|Closest pair of points problem]]
+* [http://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairDQ.html Closest Pair (McGill)]
+* [http://www.cs.ucsb.edu/~suri/cs235/ClosestPair.pdf Closest Pair (UCSB)]
+* [http://classes.cec.wustl.edu/~cse241/handouts/closestpair.pdf Closest pair (WUStL)]
+* [http://www.cs.iupui.edu/~xkzou/teaching/CS580/Divide-and-conquer-closestPair.ppt Closest pair (IUPUI)]
diff --git a/Task/Closest-pair_problem/1META.yaml b/Task/Closest-pair_problem/1META.yaml
new file mode 100644
index 0000000000..f407ff9d83
--- /dev/null
+++ b/Task/Closest-pair_problem/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Classic CS problems and programs
diff --git a/Task/Closest-pair_problem/Clojure/closest_pair_problem.clj b/Task/Closest-pair_problem/Clojure/closest_pair_problem.clj
new file mode 100644
index 0000000000..f1cb65f17d
--- /dev/null
+++ b/Task/Closest-pair_problem/Clojure/closest_pair_problem.clj
@@ -0,0 +1,36 @@
+(defn distance [[x1 y1] [x2 y2]]
+  (let [dx (- x2 x1), dy (- y2 y1)]
+    (Math/sqrt (+ (* dx dx) (* dy dy)))))
+
+(defn brute-force [points]
+  (let [n (count points)]
+    (when (< 1 n)
+      (apply min-key first
+             (for [i (range 0 (dec n)), :let [p1 (nth points i)],
+                   j (range (inc i) n), :let [p2 (nth points j)]]
+               [(distance p1 p2) p1 p2])))))
+
+(defn combine [yS [dmin pmin1 pmin2]]
+  (apply min-key first
+         (conj (for [[p1 p2] (partition 2 1 yS)
+                     :let [[_ py1] p1 [_ py2] p2]
+                     :while (< (- py1 py2) dmin)]
+                 [(distance p1 p2) p1 p2])
+               [dmin pmin1 pmin2])))
+
+(defn closest-pair
+  ([points]
+     (closest-pair
+      (sort-by first points)
+      (sort-by second points)))
+  ([xP yP]
+     (if (< (count xP) 4)
+       (brute-force xP)
+       (let [[xL xR] (partition-all (Math/ceil (/ (count xP) 2)) xP)
+             [xm _] (last xL)
+             {yL true yR false} (group-by (fn [[px _]] (<= px xm)) yP)
+             dL&pairL (closest-pair xL yL)
+             dR&pairR (closest-pair xR yR)
+             [dmin pmin1 pmin2] (min-key first dL&pairL dR&pairR)
+             {yS true} (group-by (fn [[px _]] (< (Math/abs (- xm px)) dmin)) yP)]
+         (combine yS [dmin pmin1 pmin2])))))
diff --git a/Task/Closest-pair_problem/Go/closest_pair_problem-2.go b/Task/Closest-pair_problem/Go/closest_pair_problem-2.go
new file mode 100644
index 0000000000..3ff526a213
--- /dev/null
+++ b/Task/Closest-pair_problem/Go/closest_pair_problem-2.go
@@ -0,0 +1,117 @@
+// implementation following algorithm described in
+// http://www.cs.umd.edu/~samir/grant/cp.pdf
+package main
+
+import (
+    "fmt"
+    "math"
+    "math/rand"
+)
+
+// number of points to search for closest pair
+const n = 1e6
+
+// size of bounding box for points.
+// x and y will be random with uniform distribution in the range [0,scale).
+const scale = 1.
+
+// point struct
+type xy struct {
+    x, y float64 // coordinates
+    key  int64   // an annotation used in the algorithm
+}
+
+// Euclidian distance
+func d(p1, p2 xy) float64 {
+    dx := p2.x - p1.x
+    dy := p2.y - p1.y
+    return math.Sqrt(dx*dx + dy*dy)
+}
+
+func main() {
+    points := make([]xy, n)
+    for i := range points {
+        points[i] = xy{rand.Float64(), rand.Float64() * scale, 0}
+    }
+    p1, p2 := closestPair(points)
+    fmt.Println(p1, p2)
+    fmt.Println("distance:", d(p1, p2))
+}
+
+func closestPair(s []xy) (p1, p2 xy) {
+    if len(s) < 2 {
+        panic("2 points required")
+    }
+    var dxi float64
+    // step 0
+    for s1, i := s, 1; ; i++ {
+        // step 1: compute min distance to a random point
+        // (for the case of random data, it's enough to just try
+        // to pick a different point)
+        rp := i % len(s1)
+        xi := s1[rp]
+        dxi = 2 * scale
+        for p, xn := range s1 {
+            if p != rp {
+                if dq := d(xi, xn); dq < dxi {
+                    dxi = dq
+                }
+            }
+        }
+
+        // step 2: filter
+        invB := 3 / dxi             // b is size of a mesh cell
+        mx := int64(scale*invB) + 1 // mx is number of cells along a side
+        // construct map as a histogram:
+        // key is index into mesh.  value is count of points in cell
+        hm := make(map[int64]int)
+        for ip, p := range s1 {
+            key := int64(p.x*invB)*mx + int64(p.y*invB)
+            s1[ip].key = key
+            hm[key]++
+        }
+        // construct s2 = s1 less the points without neighbors
+        var s2 []xy
+        nx := []int64{-mx - 1, -mx, -mx + 1, -1, 0, 1, mx - 1, mx, mx + 1}
+        for i, p := range s1 {
+            nn := 0
+            for _, ofs := range nx {
+                nn += hm[p.key+ofs]
+                if nn > 1 {
+                    s2 = append(s2, s1[i])
+                    break
+                }
+            }
+        }
+
+        // step 3: done?
+        if len(s2) == 0 {
+            break
+        }
+        s1 = s2
+    }
+    // step 4: compute answer from approximation
+    invB := 1 / dxi
+    mx := int64(scale*invB) + 1
+    hm := make(map[int64][]int)
+    for i, p := range s {
+        key := int64(p.x*invB)*mx + int64(p.y*invB)
+        s[i].key = key
+        hm[key] = append(hm[key], i)
+    }
+    nx := []int64{-mx - 1, -mx, -mx + 1, -1, 0, 1, mx - 1, mx, mx + 1}
+    var min = scale * 2
+    for ip, p := range s {
+        for _, ofs := range nx {
+            for _, iq := range hm[p.key+ofs] {
+                if ip != iq {
+                    if d1 := d(p, s[iq]); d1 < min {
+                        min = d1
+                        p1, p2 = p, s[iq]
+                    }
+                }
+            }
+        }
+    }
+    return p1, p2
+}
diff --git a/Task/Closest-pair_problem/Go/closest_pair_problem.go b/Task/Closest-pair_problem/Go/closest_pair_problem.go
new file mode 100644
index 0000000000..14cfe73db3
--- /dev/null
+++ b/Task/Closest-pair_problem/Go/closest_pair_problem.go
@@ -0,0 +1,46 @@
+package main
+
+import (
+    "fmt"
+    "math"
+    "math/rand"
+)
+
+type xy struct {
+    x, y float64
+}
+
+const n = 1000
+const scale = 1.
+
+func d(p1, p2 xy) float64 {
+    dx := p2.x - p1.x
+    dy := p2.y - p1.y
+    return math.Sqrt(dx*dx + dy*dy)
+}
+
+func main() {
+    points := make([]xy, n)
+    for i := range points {
+        points[i] = xy{rand.Float64(), rand.Float64() * scale}
+    }
+    p1, p2 := closestPair(points)
+    fmt.Println(p1, p2)
+    fmt.Println("distance:", d(p1, p2))
+}
+
+func closestPair(points []xy) (p1, p2 xy) {
+    if len(points) < 2 {
+        panic("at least two points expected")
+    }
+    min := 2 * scale
+    for i, q1 := range points[:len(points)-1] {
+        for _, q2 := range points[i+1:] {
+            if dq := d(q1, q2); dq < min {
+                p1, p2 = q1, q2
+                min = dq
+            }
+        }
+    }
+    return
+}
diff --git a/Task/Closest-pair_problem/Haskell/closest_pair_problem-2.hs b/Task/Closest-pair_problem/Haskell/closest_pair_problem-2.hs
new file mode 100644
index 0000000000..1c959a2ef1
--- /dev/null
+++ b/Task/Closest-pair_problem/Haskell/closest_pair_problem-2.hs
@@ -0,0 +1,3 @@
+*Main> testCP
+([[0.8347201880148426,0.40774840545089647],[0.8348731214261784,0.4087113189531284]],9.749825850154334e-4)
+(4.02 secs, 488869056 bytes)
diff --git a/Task/Closest-pair_problem/Haskell/closest_pair_problem.hs b/Task/Closest-pair_problem/Haskell/closest_pair_problem.hs
new file mode 100644
index 0000000000..5b9b891707
--- /dev/null
+++ b/Task/Closest-pair_problem/Haskell/closest_pair_problem.hs
@@ -0,0 +1,16 @@
+import Data.List
+import System.Random
+import Control.Monad
+import Control.Arrow
+import Data.Ord
+
+vecLeng [[a,b],[p,q]] = sqrt $ (a-p)^2+(b-q)^2
+
+findClosestPair =  foldl1' ((minimumBy (comparing vecLeng). ). (. return). (:)) .
+                   concatMap (\(x:xs) -> map ((x:).return) xs) . init . tails
+
+testCP = do
+    g <- newStdGen
+    let pts :: [[Double]]
+        pts = take 1000. unfoldr (Just. splitAt 2) $ randomRs(-1,1) g
+    print . (id &&& vecLeng ) . findClosestPair $ pts
diff --git a/Task/Closest-pair_problem/Java/closest_pair_problem.java b/Task/Closest-pair_problem/Java/closest_pair_problem.java
new file mode 100644
index 0000000000..ea6873fc08
--- /dev/null
+++ b/Task/Closest-pair_problem/Java/closest_pair_problem.java
@@ -0,0 +1,186 @@
+import java.util.*;
+
+public class ClosestPair
+{
+  public static class Point
+  {
+    public final double x;
+    public final double y;
+
+    public Point(double x, double y)
+    {
+      this.x = x;
+      this.y = y;
+    }
+
+    public String toString()
+    {  return "(" + x + ", " + y + ")";  }
+  }
+
+  public static class Pair
+  {
+    public Point point1 = null;
+    public Point point2 = null;
+    public double distance = 0.0;
+
+    public Pair()
+    {  }
+
+    public Pair(Point point1, Point point2)
+    {
+      this.point1 = point1;
+      this.point2 = point2;
+      calcDistance();
+    }
+
+    public void update(Point point1, Point point2, double distance)
+    {
+      this.point1 = point1;
+      this.point2 = point2;
+      this.distance = distance;
+    }
+
+    public void calcDistance()
+    {  this.distance = distance(point1, point2);  }
+
+    public String toString()
+    {  return point1 + "-" + point2 + " : " + distance;  }
+  }
+
+  public static double distance(Point p1, Point p2)
+  {
+    double xdist = p2.x - p1.x;
+    double ydist = p2.y - p1.y;
+    return Math.hypot(xdist, ydist);
+  }
+
+  public static Pair bruteForce(List points)
+  {
+    int numPoints = points.size();
+    if (numPoints < 2)
+      return null;
+    Pair pair = new Pair(points.get(0), points.get(1));
+    if (numPoints > 2)
+    {
+      for (int i = 0; i < numPoints - 1; i++)
+      {
+        Point point1 = points.get(i);
+        for (int j = i + 1; j < numPoints; j++)
+        {
+          Point point2 = points.get(j);
+          double distance = distance(point1, point2);
+          if (distance < pair.distance)
+            pair.update(point1, point2, distance);
+        }
+      }
+    }
+    return pair;
+  }
+
+  public static void sortByX(List points)
+  {
+    Collections.sort(points, new Comparator() {
+        public int compare(Point point1, Point point2)
+        {
+          if (point1.x < point2.x)
+            return -1;
+          if (point1.x > point2.x)
+            return 1;
+          return 0;
+        }
+      }
+    );
+  }
+
+  public static void sortByY(List points)
+  {
+    Collections.sort(points, new Comparator() {
+        public int compare(Point point1, Point point2)
+        {
+          if (point1.y < point2.y)
+            return -1;
+          if (point1.y > point2.y)
+            return 1;
+          return 0;
+        }
+      }
+    );
+  }
+
+  public static Pair divideAndConquer(List points)
+  {
+    List pointsSortedByX = new ArrayList(points);
+    sortByX(pointsSortedByX);
+    List pointsSortedByY = new ArrayList(points);
+    sortByY(pointsSortedByY);
+    return divideAndConquer(pointsSortedByX, pointsSortedByY);
+  }
+
+  private static Pair divideAndConquer(List pointsSortedByX, List pointsSortedByY)
+  {
+    int numPoints = pointsSortedByX.size();
+    if (numPoints <= 3)
+      return bruteForce(pointsSortedByX);
+
+    int dividingIndex = numPoints >>> 1;
+    List leftOfCenter = pointsSortedByX.subList(0, dividingIndex);
+    List rightOfCenter = pointsSortedByX.subList(dividingIndex, numPoints);
+
+    List tempList = new ArrayList(leftOfCenter);
+    sortByY(tempList);
+    Pair closestPair = divideAndConquer(leftOfCenter, tempList);
+
+    tempList.clear();
+    tempList.addAll(rightOfCenter);
+    sortByY(tempList);
+    Pair closestPairRight = divideAndConquer(rightOfCenter, tempList);
+
+    if (closestPairRight.distance < closestPair.distance)
+      closestPair = closestPairRight;
+
+    tempList.clear();
+    double shortestDistance =closestPair.distance;
+    double centerX = rightOfCenter.get(0).x;
+    for (Point point : pointsSortedByY)
+      if (Math.abs(centerX - point.x) < shortestDistance)
+        tempList.add(point);
+
+    for (int i = 0; i < tempList.size() - 1; i++)
+    {
+      Point point1 = tempList.get(i);
+      for (int j = i + 1; j < tempList.size(); j++)
+      {
+        Point point2 = tempList.get(j);
+        if ((point2.y - point1.y) >= shortestDistance)
+          break;
+        double distance = distance(point1, point2);
+        if (distance < closestPair.distance)
+        {
+          closestPair.update(point1, point2, distance);
+          shortestDistance = distance;
+        }
+      }
+    }
+    return closestPair;
+  }
+
+  public static void main(String[] args)
+  {
+    int numPoints = (args.length == 0) ? 1000 : Integer.parseInt(args[0]);
+    List points = new ArrayList();
+    Random r = new Random();
+    for (int i = 0; i < numPoints; i++)
+      points.add(new Point(r.nextDouble(), r.nextDouble()));
+    System.out.println("Generated " + numPoints + " random points");
+    long startTime = System.currentTimeMillis();
+    Pair bruteForceClosestPair = bruteForce(points);
+    long elapsedTime = System.currentTimeMillis() - startTime;
+    System.out.println("Brute force (" + elapsedTime + " ms): " + bruteForceClosestPair);
+    startTime = System.currentTimeMillis();
+    Pair dqClosestPair = divideAndConquer(points);
+    elapsedTime = System.currentTimeMillis() - startTime;
+    System.out.println("Divide and conquer (" + elapsedTime + " ms): " + dqClosestPair);
+    if (bruteForceClosestPair.distance != dqClosestPair.distance)
+      System.out.println("MISMATCH");
+  }
+}
diff --git a/Task/Closest-pair_problem/JavaScript/closest_pair_problem.js b/Task/Closest-pair_problem/JavaScript/closest_pair_problem.js
new file mode 100644
index 0000000000..b6926543db
--- /dev/null
+++ b/Task/Closest-pair_problem/JavaScript/closest_pair_problem.js
@@ -0,0 +1,27 @@
+function distance(p1, p2) {
+  var dx = Math.abs(p1.x - p2.x);
+  var dy = Math.abs(p1.y - p2.y);
+  return Math.sqrt(dx*dx + dy*dy);
+}
+
+function bruteforceClosestPair(arr) {
+  if (arr.length < 2) {
+    return Infinity;
+  } else {
+    var minDist = distance(arr[0], arr[1]);
+    var minPoints = arr.slice(0, 2);
+
+    for (var i=0; i[0] - $b->[0])**2 +
+                 ($a->[1] - $b->[1])**2 );
+}
+
+sub closest_pair_simple
+{
+    my $ra = shift;
+    my @arr = @$ra;
+    my $inf = 1e600;
+    return $inf if scalar(@arr) < 2;
+    my ( $a, $b, $d ) = ($arr[0], $arr[1], dist($arr[0], $arr[1]));
+    while( @arr ) {
+	my $p = pop @arr;
+	foreach my $l (@arr) {
+	    my $t = dist($p, $l);
+	    ($a, $b, $d) = ($p, $l, $t) if $t < $d;	
+	}
+    }
+    return ($a, $b, $d);
+}
+
+sub closest_pair
+{
+    my $r = shift;
+    my @ax = sort { $a->[0] <=> $b->[0] } @$r;
+    my @ay = sort { $a->[1] <=> $b->[1] } @$r;
+    return closest_pair_real(\@ax, \@ay);
+}
+
+sub closest_pair_real
+{
+    my ($rx, $ry) = @_;
+    my @xP = @$rx;
+    my @yP = @$ry;
+    my $N = @xP;
+    return closest_pair_simple($rx) if scalar(@xP) <= 3;
+
+    my $inf = 1e600;
+    my $midx = ceil($N/2)-1;
+
+    my @PL = @xP[0 .. $midx];
+    my @PR = @xP[$midx+1 .. $N-1];
+
+    my $xm = ${$xP[$midx]}[0];
+
+    my @yR = ();
+    my @yL = ();
+    foreach my $p (@yP) {
+	if ( ${$p}[0] <= $xm ) {
+	    push @yR, $p;
+	} else {
+	    push @yL, $p;
+	}
+    }
+
+    my ($al, $bl, $dL) = closest_pair_real(\@PL, \@yR);
+    my ($ar, $br, $dR) = closest_pair_real(\@PR, \@yL);
+
+    my ($m1, $m2, $dmin) = ($al, $bl, $dL);
+    ($m1, $m2, $dmin) = ($ar, $br, $dR) if $dR < $dL;
+
+    my @yS = ();
+    foreach my $p (@yP) {
+	push @yS, $p if abs($xm - ${$p}[0]) < $dmin;
+    }
+
+    if ( @yS ) {
+	my ( $w1, $w2, $closest ) = ($m1, $m2, $dmin);
+	foreach my $i (0 .. ($#yS - 1)) {
+
+	    my $k = $i + 1;
+	    while ( ($k <= $#yS) && ( (${$yS[$k]}[1] - ${$yS[$i]}[1]) < $dmin) ) {
+		my $d = dist($yS[$k], $yS[$i]);
+		($w1, $w2, $closest) = ($yS[$k], $yS[$i], $d) if $d < $closest;
+		$k++;
+	    }
+
+	}
+	return ($w1, $w2, $closest);
+
+    } else {
+	return ($m1, $m2, $dmin);
+    }
+}
+
+
+
+my @points = ();
+my $N = 5000;
+
+foreach my $i (1..$N) {
+    push @points, [rand(20)-10.0, rand(20)-10.0];
+}
+
+
+my ($a, $b, $d) = closest_pair_simple(\@points);
+print "$d\n";
+
+my ($a1, $b1, $d1) = closest_pair(\@points);
+#print "$d1\n";
diff --git a/Task/Closest-pair_problem/PicoLisp/closest_pair_problem.l b/Task/Closest-pair_problem/PicoLisp/closest_pair_problem.l
new file mode 100644
index 0000000000..552d6c5846
--- /dev/null
+++ b/Task/Closest-pair_problem/PicoLisp/closest_pair_problem.l
@@ -0,0 +1,14 @@
+(de closestPairBF (Lst)
+   (let Min T
+      (use (Pt1 Pt2)
+         (for P Lst
+            (for Q Lst
+               (or
+                  (== P Q)
+                  (>=
+                     (setq N
+                        (let (A (- (car P) (car Q))  B (- (cdr P) (cdr Q)))
+                           (+ (* A A) (* B B)) ) )
+                     Min )
+                  (setq Min N  Pt1 P  Pt2 Q) ) ) )
+         (list Pt1 Pt2 (sqrt Min)) ) ) )
diff --git a/Task/Closest-pair_problem/Python/closest_pair_problem.py b/Task/Closest-pair_problem/Python/closest_pair_problem.py
new file mode 100644
index 0000000000..c2e977f6d4
--- /dev/null
+++ b/Task/Closest-pair_problem/Python/closest_pair_problem.py
@@ -0,0 +1,87 @@
+"""
+  Compute nearest pair of points using two algorithms
+
+  First algorithm is 'brute force' comparison of every possible pair.
+  Second, 'divide and conquer', is based on:
+    www.cs.iupui.edu/~xkzou/teaching/CS580/Divide-and-conquer-closestPair.ppt
+"""
+
+from random import randint, randrange
+from operator import itemgetter, attrgetter
+
+infinity = float('inf')
+
+# Note the use of complex numbers to represent 2D points making distance == abs(P1-P2)
+
+def bruteForceClosestPair(point):
+    numPoints = len(point)
+    if numPoints < 2:
+        return infinity, (None, None)
+    return min( ((abs(point[i] - point[j]), (point[i], point[j]))
+                 for i in range(numPoints-1)
+                 for j in range(i+1,numPoints)),
+                key=itemgetter(0))
+
+def closestPair(point):
+    xP = sorted(point, key= attrgetter('real'))
+    yP = sorted(point, key= attrgetter('imag'))
+    return _closestPair(xP, yP)
+
+def _closestPair(xP, yP):
+    numPoints = len(xP)
+    if numPoints <= 3:
+        return bruteForceClosestPair(xP)
+    Pl = xP[:numPoints/2]
+    Pr = xP[numPoints/2:]
+    Yl, Yr = [], []
+    xDivider = Pl[-1].real
+    for p in yP:
+        if p.real <= xDivider:
+            Yl.append(p)
+        else:
+            Yr.append(p)
+    dl, pairl = _closestPair(Pl, Yl)
+    dr, pairr = _closestPair(Pr, Yr)
+    dm, pairm = (dl, pairl) if dl < dr else (dr, pairr)
+    # Points within dm of xDivider sorted by Y coord
+    closeY = [p for p in yP  if abs(p.real - xDivider) < dm]
+    numCloseY = len(closeY)
+    if numCloseY > 1:
+        # There is a proof that you only need compare a max of 7 next points
+        closestY = min( ((abs(closeY[i] - closeY[j]), (closeY[i], closeY[j]))
+                         for i in range(numCloseY-1)
+                         for j in range(i+1,min(i+8, numCloseY))),
+                        key=itemgetter(0))
+        return (dm, pairm) if dm <= closestY[0] else closestY
+    else:
+        return dm, pairm
+
+def times():
+    ''' Time the different functions
+    '''
+    import timeit
+
+    functions = [bruteForceClosestPair, closestPair]
+    for f in functions:
+        print 'Time for', f.__name__, timeit.Timer(
+            '%s(pointList)' % f.__name__,
+            'from closestpair import %s, pointList' % f.__name__).timeit(number=1)
+
+
+
+pointList = [randint(0,1000)+1j*randint(0,1000) for i in range(2000)]
+
+if __name__ == '__main__':
+    pointList = [(5+9j), (9+3j), (2+0j), (8+4j), (7+4j), (9+10j), (1+9j), (8+2j), 10j, (9+6j)]
+    print pointList
+    print '  bruteForceClosestPair:', bruteForceClosestPair(pointList)
+    print '            closestPair:', closestPair(pointList)
+    for i in range(10):
+        pointList = [randrange(11)+1j*randrange(11) for i in range(10)]
+        print '\n', pointList
+        print ' bruteForceClosestPair:', bruteForceClosestPair(pointList)
+        print '           closestPair:', closestPair(pointList)
+    print '\n'
+    times()
+    times()
+    times()
diff --git a/Task/Closest-pair_problem/R/closest_pair_problem-2.r b/Task/Closest-pair_problem/R/closest_pair_problem-2.r
new file mode 100644
index 0000000000..76870ff90b
--- /dev/null
+++ b/Task/Closest-pair_problem/R/closest_pair_problem-2.r
@@ -0,0 +1,20 @@
+closestPair<-function(x,y)
+  {
+  distancev <- function(pointsv)
+    {
+    x1 <- pointsv[1]
+    y1 <- pointsv[2]
+    x2 <- pointsv[3]
+    y2 <- pointsv[4]
+    sqrt((x1 - x2)^2 + (y1 - y2)^2)
+    }
+  pairstocompare <- t(combn(length(x),2))
+  pointsv <- cbind(x[pairstocompare[,1]],y[pairstocompare[,1]],x[pairstocompare[,2]],y[pairstocompare[,2]])
+  pairstocompare <- cbind(pairstocompare,apply(pointsv,1,distancev))
+  minrow <- pairstocompare[pairstocompare[,3] == min(pairstocompare[,3])]
+  if (!is.null(nrow(minrow))) {print("More than one point at this distance!"); minrow <- minrow[1,]}
+  cat("The closest pair is:\n\tPoint 1: ",x[minrow[1]],", ",y[minrow[1]],
+                          "\n\tPoint 2: ",x[minrow[2]],", ",y[minrow[2]],
+                          "\n\tDistance: ",minrow[3],"\n",sep="")
+  c(distance=minrow[3],x1.x=x[minrow[1]],y1.y=y[minrow[1]],x2.x=x[minrow[2]],y2.y=y[minrow[2]])
+  }
diff --git a/Task/Closest-pair_problem/R/closest_pair_problem-3.r b/Task/Closest-pair_problem/R/closest_pair_problem-3.r
new file mode 100644
index 0000000000..72cbacc69f
--- /dev/null
+++ b/Task/Closest-pair_problem/R/closest_pair_problem-3.r
@@ -0,0 +1,18 @@
+closest.pairs <- function(x, y=NULL, ...){
+      # takes two-column object(x,y-values), or creates such an object from x and y values
+       if(!is.null(y))  x <- cbind(x, y)
+
+       distances <- dist(x)
+        min.dist <- min(distances)
+          point.pair <- combn(1:nrow(x), 2)[, which.min(distances)]
+
+     cat("The closest pair is:\n\t",
+      sprintf("Point 1: %.3f, %.3f \n\tPoint 2: %.3f, %.3f \n\tDistance: %.3f.\n",
+        x[point.pair[1],1], x[point.pair[1],2],
+          x[point.pair[2],1], x[point.pair[2],2],
+            min.dist),
+            sep=""   )
+     c( x1=x[point.pair[1],1],y1=x[point.pair[1],2],
+        x2=x[point.pair[2],1],y2=x[point.pair[2],2],
+        distance=min.dist)
+     }
diff --git a/Task/Closest-pair_problem/R/closest_pair_problem-4.r b/Task/Closest-pair_problem/R/closest_pair_problem-4.r
new file mode 100644
index 0000000000..9078216032
--- /dev/null
+++ b/Task/Closest-pair_problem/R/closest_pair_problem-4.r
@@ -0,0 +1,36 @@
+x = (sample(-1000.00:1000.00,100))
+y = (sample(-1000.00:1000.00,length(x)))
+cp = closest.pairs(x,y)
+#cp = closestPair(x,y)
+plot(x,y,pch=19,col='black',main="Closest Pair", asp=1)
+points(cp["x1.x"],cp["y1.y"],pch=19,col='red')
+points(cp["x2.x"],cp["y2.y"],pch=19,col='red')
+#closest_pair_brute(x,y,T)
+
+Performance
+system.time(closest_pair_brute(x,y), gcFirst = TRUE)
+Shortest path found =
+ From:          (32,-987)
+ To:            (25,-993)
+ Distance:      9.219544
+
+   user  system elapsed
+   0.35    0.02    0.37
+
+system.time(closest.pairs(x,y), gcFirst = TRUE)
+The closest pair is:
+        Point 1: 32.000, -987.000
+        Point 2: 25.000, -993.000
+        Distance: 9.220.
+
+   user  system elapsed
+   0.08    0.00    0.10
+
+system.time(closestPair(x,y), gcFirst = TRUE)
+The closest pair is:
+        Point 1: 32, -987
+        Point 2: 25, -993
+        Distance: 9.219544
+
+   user  system elapsed
+   0.17    0.00    0.19
diff --git a/Task/Closest-pair_problem/R/closest_pair_problem-5.r b/Task/Closest-pair_problem/R/closest_pair_problem-5.r
new file mode 100644
index 0000000000..ae75a18e56
--- /dev/null
+++ b/Task/Closest-pair_problem/R/closest_pair_problem-5.r
@@ -0,0 +1,88 @@
+closest.pairs.bruteforce <- function(x, y=NULL)
+{
+	if (!is.null(y))
+	{
+		x <- cbind(x,y)
+	}
+	d <- dist(x)
+	cp <- x[combn(1:nrow(x), 2)[, which.min(d)],]
+	list(p1=cp[1,], p2=cp[2,], d=min(d))
+}
+
+closest.pairs.dandc <- function(x, y=NULL)
+{
+	if (!is.null(y))
+	{
+		x <- cbind(x,y)
+	}
+	if (sd(x[,"x"]) < sd(x[,"y"]))
+	{
+		x <- cbind(x=x[,"y"],y=x[,"x"])
+		swap <- TRUE
+	}
+	else
+	{
+		swap <- FALSE
+	}
+	xp <- x[order(x[,"x"]),]
+	.cpdandc.rec <- function(xp,yp)
+	{
+		n <- dim(xp)[1]
+		if (n <= 4)
+		{
+			closest.pairs.bruteforce(xp)
+		}
+		else
+		{
+			xl <- xp[1:floor(n/2),]
+			xr <- xp[(floor(n/2)+1):n,]
+			cpl <- .cpdandc.rec(xl)
+			cpr <- .cpdandc.rec(xr)
+			if (cpl$d 1)
+	{
+		for (i in 1:(nys-1))
+		{
+			k <- i + 1
+			while (k <= nys && ys[i,"y"] - ys[k,"y"] < cp$d)
+			{
+				d <- sqrt((ys[k,"x"]-ys[i,"x"])^2 + (ys[k,"y"]-ys[i,"y"])^2)
+				if (d < cp$d) cp <- list(p1=ys[i,],p2=ys[k,],d=d)
+				k <- k + 1
+			}
+		}
+	}
+	if (swap)
+	{
+		list(p1=cbind(x=cp$p1["y"],y=cp$p1["x"]),p2=cbind(x=cp$p2["y"],y=cp$p2["x"]),d=cp$d)
+	}
+	else
+	{
+		cp
+	}
+}
+
+# Test functions
+cat("How many points?\n")
+n <- scan(what=integer(),n=1)
+x <- rnorm(n)
+y <- rnorm(n)
+tstart <- proc.time()[3]
+cat("Closest pairs divide and conquer:\n")
+print(cp <- closest.pairs.dandc(x,y))
+cat(sprintf("That took %.2f seconds.\n",proc.time()[3] - tstart))
+plot(x,y)
+points(c(cp$p1["x"],cp$p2["x"]),c(cp$p1["y"],cp$p2["y"]),col="red")
+tstart <- proc.time()[3]
+cat("\nClosest pairs brute force:\n")
+print(closest.pairs.bruteforce(x,y))
+cat(sprintf("That took %.2f seconds.\n",proc.time()[3] - tstart))
diff --git a/Task/Closest-pair_problem/R/closest_pair_problem.r b/Task/Closest-pair_problem/R/closest_pair_problem.r
new file mode 100644
index 0000000000..0e23d00376
--- /dev/null
+++ b/Task/Closest-pair_problem/R/closest_pair_problem.r
@@ -0,0 +1,30 @@
+closest_pair_brute <-function(x,y,plotxy=F) {
+    xy = cbind(x,y)
+    cp = bruteforce(xy)
+    cat("\n\nShortest path found = \n From:\t\t(",cp[1],',',cp[2],")\n To:\t\t(",cp[3],',',cp[4],")\n Distance:\t",cp[5],"\n\n",sep="")
+    if(plotxy) {
+        plot(x,y,pch=19,col='black',main="Closest Pair", asp=1)
+        points(cp[1],cp[2],pch=19,col='red')
+        points(cp[3],cp[4],pch=19,col='red')
+    }
+    distance <- function(p1,p2) {
+        x1 = (p1[1])
+        y1 = (p1[2])
+        x2 = (p2[1])
+        y2 = (p2[2])
+        sqrt((x2-x1)^2 + (y2-y1)^2)
+    }
+    bf_iter <- function(m,p,idx=NA,d=NA,n=1) {
+        dd = distance(p,m[n,])
+        if((is.na(d) || dd<=d) && p!=m[n,]){d = dd; idx=n;}
+        if(n == length(m[,1])) { c(m[idx,],d) }
+        else bf_iter(m,p,idx,d,n+1)
+    }
+    bruteforce <- function(pmatrix,n=1,pd=c(NA,NA,NA,NA,NA)) {
+        p = pmatrix[n,]
+        ppd = c(p,bf_iter(pmatrix,p))
+        if(ppd[5]9;  m.j=p;  p=p%2+1;   end
+      do k=j+5 to 0 by -1; if m.k>11 then numeric digits m.k; g=.5*(g+x/g); end
+      numeric digits d;  return g/1
+.sqrtG:  numeric form;   m.=11;   p=d+d%4+2
+         parse value format(x,2,1,,0) 'E0' with g 'E' _ .;   return g*.5'E'_%2
diff --git a/Task/Closest-pair_problem/Ruby/closest_pair_problem.rb b/Task/Closest-pair_problem/Ruby/closest_pair_problem.rb
new file mode 100644
index 0000000000..8dbd92a3e7
--- /dev/null
+++ b/Task/Closest-pair_problem/Ruby/closest_pair_problem.rb
@@ -0,0 +1,68 @@
+Point = Struct.new(:x, :y)
+
+def distance(p1, p2)
+  Math.hypot(p1.x - p2.x, p1.y - p2.y)
+end
+
+def closest_bruteforce(points)
+  mindist, minpts = Float::MAX, []
+  points.length.times do |i|
+    (i+1).upto(points.length - 1) do |j|
+      dist = distance(points[i], points[j])
+      if dist < mindist
+        mindist = dist
+        minpts = [points[i], points[j]]
+      end
+    end
+  end
+  [mindist, minpts]
+end
+
+def closest_recursive(points)
+  if points.length <= 3
+    return closest_bruteforce(points)
+  end
+  xP = points.sort_by {|p| p.x}
+  mid = (points.length / 2.0).ceil
+  pL = xP[0,mid]
+  pR = xP[mid..-1]
+  dL, pairL = closest_recursive(pL)
+  dR, pairR = closest_recursive(pR)
+  if dL < dR
+    dmin, dpair = dL, pairL
+  else
+    dmin, dpair = dR, pairR
+  end
+  yP = xP.find_all {|p| (pL[-1].x - p.x).abs < dmin}.sort_by {|p| p.y}
+  closest = Float::MAX
+  closestPair = []
+  0.upto(yP.length - 2) do |i|
+    (i+1).upto(yP.length - 1) do |k|
+      break if (yP[k].y - yP[i].y) >= dmin
+      dist = distance(yP[i], yP[k])
+      if dist < closest
+        closest = dist
+        closestPair = [yP[i], yP[k]]
+      end
+    end
+  end
+  if closest < dmin
+    [closest, closestPair]
+  else
+    [dmin, dpair]
+  end
+end
+
+
+points = Array.new(100) {Point.new(rand, rand)}
+p ans1 = closest_bruteforce(points)
+p ans2 = closest_recursive(points)
+fail "bogus!" if ans1[0] != ans2[0]
+
+require 'benchmark'
+
+points = Array.new(10000) {Point.new(rand, rand)}
+Benchmark.bm(12) do |x|
+  x.report("bruteforce") {ans1 = closest_bruteforce(points)}
+  x.report("recursive")  {ans2 = closest_recursive(points)}
+end
diff --git a/Task/Closest-pair_problem/Scala/closest_pair_problem.scala b/Task/Closest-pair_problem/Scala/closest_pair_problem.scala
new file mode 100644
index 0000000000..75776ad259
--- /dev/null
+++ b/Task/Closest-pair_problem/Scala/closest_pair_problem.scala
@@ -0,0 +1,24 @@
+import scala.util._
+
+object ClosestPair{
+   class Point(x:Double, y:Double) extends Pair(x,y){
+      def distance(p:Point)=math.hypot(_1-p._1, _2-p._2)
+   }
+
+   def closestPairBF(a:Array[Point])={
+      var minDist=a(0) distance a(1)
+      var minPoints=(a(0), a(1))
+
+      for(p1<-a; p2<-a if p1.ne(p2); dist=p1 distance p2 if(dist"+dist)
+   }
+}
diff --git a/Task/Closest-pair_problem/Tcl/closest_pair_problem.tcl b/Task/Closest-pair_problem/Tcl/closest_pair_problem.tcl
new file mode 100644
index 0000000000..d8c0b24f5b
--- /dev/null
+++ b/Task/Closest-pair_problem/Tcl/closest_pair_problem.tcl
@@ -0,0 +1,90 @@
+package require Tcl 8.5
+
+# retrieve the x-coordinate
+proc x p {lindex $p 0}
+# retrieve the y-coordinate
+proc y p {lindex $p 1}
+
+proc distance {p1 p2} {
+    expr {hypot(([x $p1]-[x $p2]), ([y $p1]-[y $p2]))}
+}
+
+proc closest_bruteforce {points} {
+    set n [llength $points]
+    set mindist Inf
+    set minpts {}
+    for {set i 0} {$i < $n - 1} {incr i} {
+        for {set j [expr {$i + 1}]} {$j < $n} {incr j} {
+            set p1 [lindex $points $i]
+            set p2 [lindex $points $j]
+            set dist [distance $p1 $p2]
+            if {$dist < $mindist} {
+                set mindist $dist
+                set minpts [list $p1 $p2]
+            }
+        }
+    }
+    return [list $mindist $minpts]
+}
+
+proc closest_recursive {points} {
+    set n [llength $points]
+    if {$n <= 3} {
+        return [closest_bruteforce $points]
+    }
+    set xP [lsort -real -increasing -index 0 $points]
+    set mid [expr {int(ceil($n/2.0))}]
+    set PL [lrange $xP 0 [expr {$mid-1}]]
+    set PR [lrange $xP $mid end]
+    set procname [lindex [info level 0] 0]
+    lassign [$procname $PL] dL pairL
+    lassign [$procname $PR] dR pairR
+    if {$dL < $dR} {
+        set dmin $dL
+        set dpair $pairL
+    } else {
+        set dmin $dR
+        set dpair $pairR
+    }
+
+    set xM [x [lindex $PL end]]
+    foreach p $xP {
+        if {abs($xM - [x $p]) < $dmin} {
+            lappend S $p
+        }
+    }
+    set yP [lsort -real -increasing -index 1 $S]
+    set closest Inf
+    set nP [llength $yP]
+    for {set i 0} {$i <= $nP-2} {incr i} {
+        set yPi [lindex $yP $i]
+        for {set k [expr {$i+1}]; set yPk [lindex $yP $k]} {
+            $k < $nP-1 && ([y $yPk]-[y $yPi]) < $dmin
+        } {incr k; set yPk [lindex $yP $k]} {
+            set dist [distance $yPk $yPi]
+            if {$dist < $closest} {
+                set closest $dist
+                set closestPair [list $yPi $yPk]
+            }
+        }
+    }
+    expr {$closest < $dmin ? [list $closest $closestPair] : [list $dmin $dpair]}
+}
+
+# testing
+set N 10000
+for {set i 1} {$i <= $N} {incr i} {
+    lappend points [list [expr {rand()*100}] [expr {rand()*100}]]
+}
+
+# instrument the number of calls to [distance] to examine the
+# efficiency of the recursive solution
+trace add execution distance enter comparisons
+proc comparisons args {incr ::comparisons}
+
+puts [format "%-10s  %9s  %9s  %s" method compares time closest]
+foreach method {bruteforce recursive} {
+    set ::comparisons 0
+    set time [time {set ::dist($method) [closest_$method $points]} 1]
+    puts [format "%-10s  %9d  %9d  %s" $method $::comparisons [lindex $time 0] [lindex $::dist($method) 0]]
+}
diff --git a/Task/Collections/0DESCRIPTION b/Task/Collections/0DESCRIPTION
new file mode 100644
index 0000000000..90ae92a2ee
--- /dev/null
+++ b/Task/Collections/0DESCRIPTION
@@ -0,0 +1,3 @@
+{{clarified-review}}Collections are abstractions to represent sets of values.  In statically-typed languages, the values are typically of a common data type.
+
+Create a collection, and add a few values to it.
diff --git a/Task/Collections/1META.yaml b/Task/Collections/1META.yaml
new file mode 100644
index 0000000000..659c8686af
--- /dev/null
+++ b/Task/Collections/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Basic language learning
diff --git a/Task/Collections/AWK/collections-2.awk b/Task/Collections/AWK/collections-2.awk
new file mode 100644
index 0000000000..ae01eaa265
--- /dev/null
+++ b/Task/Collections/AWK/collections-2.awk
@@ -0,0 +1 @@
+split("one two three",a)
diff --git a/Task/Collections/AWK/collections-3.awk b/Task/Collections/AWK/collections-3.awk
new file mode 100644
index 0000000000..8821dba57c
--- /dev/null
+++ b/Task/Collections/AWK/collections-3.awk
@@ -0,0 +1 @@
+print a[0]
diff --git a/Task/Collections/AWK/collections-4.awk b/Task/Collections/AWK/collections-4.awk
new file mode 100644
index 0000000000..a6c2efb483
--- /dev/null
+++ b/Task/Collections/AWK/collections-4.awk
@@ -0,0 +1 @@
+for(i in a) print i":"a[i]
diff --git a/Task/Collections/AWK/collections.awk b/Task/Collections/AWK/collections.awk
new file mode 100644
index 0000000000..93ebd8c18c
--- /dev/null
+++ b/Task/Collections/AWK/collections.awk
@@ -0,0 +1 @@
+a[0]="hello"
diff --git a/Task/Collections/C/collections-2.c b/Task/Collections/C/collections-2.c
new file mode 100644
index 0000000000..6a24d3abd8
--- /dev/null
+++ b/Task/Collections/C/collections-2.c
@@ -0,0 +1,12 @@
+int* ar;                  /* Collection ar; */
+int arSize;
+arSize = (rand() % 6) + 1;
+ar = calloc(arSize, sizeof(int) ); /* ar = new ArrayList(arSize); */
+ar[0] = 1;                /* ar.set(0, 1); */
+
+int* p;                   /* Iterator p; Integer pValue; */
+for (p=ar;                /* p=ar.itereator(); for( pValue=p.next(); */
+       p<(ar+arSize);     /*                         p.hasNext(); */
+       p++) {             /*                         pValue=p.next() ) { */
+  printf("%d\n",*p);      /*   System.out.println(pValue); */
+}                         /* }    */
diff --git a/Task/Collections/C/collections.c b/Task/Collections/C/collections.c
new file mode 100644
index 0000000000..69c9a98589
--- /dev/null
+++ b/Task/Collections/C/collections.c
@@ -0,0 +1,11 @@
+#define cSize( a )  ( sizeof(a)/sizeof(a[0]) ) /* a.size() */
+int ar[10];               /* Collection ar = new ArrayList(10); */
+ar[0] = 1;                /* ar.set(0, 1); */
+ar[1] = 2;
+
+int* p;                   /* Iterator p; Integer pValue; */
+for (p=ar;                /* for( p = ar.itereator(), pValue=p.next(); */
+       p<(ar+cSize(ar));  /*        p.hasNext(); */
+       p++) {             /*        pValue=p.next() ) { */
+  printf("%d\n",*p);      /*   System.out.println(pValue); */
+}                         /* } */
diff --git a/Task/Collections/Clojure/collections-2.clj b/Task/Collections/Clojure/collections-2.clj
new file mode 100644
index 0000000000..78ba17427f
--- /dev/null
+++ b/Task/Collections/Clojure/collections-2.clj
@@ -0,0 +1,3 @@
+'(1 4 7) ; a linked list
+(list 1 4 7)
+(cons 1 (cons 4 '(7)))
diff --git a/Task/Collections/Clojure/collections-3.clj b/Task/Collections/Clojure/collections-3.clj
new file mode 100644
index 0000000000..7371387449
--- /dev/null
+++ b/Task/Collections/Clojure/collections-3.clj
@@ -0,0 +1,3 @@
+['a 4 11] ; somewhere between array and list
+(vector 'a 4 11)
+(cons ['a 4] 11) ; vectors add at the *end*
diff --git a/Task/Collections/Clojure/collections-4.clj b/Task/Collections/Clojure/collections-4.clj
new file mode 100644
index 0000000000..638fa098ca
--- /dev/null
+++ b/Task/Collections/Clojure/collections-4.clj
@@ -0,0 +1,3 @@
+#{:pig :dog :bear}
+(assoc #{:pig :bear} :dog)
+(set [:pig :bear :dog])
diff --git a/Task/Collections/Clojure/collections.clj b/Task/Collections/Clojure/collections.clj
new file mode 100644
index 0000000000..0df46d10ed
--- /dev/null
+++ b/Task/Collections/Clojure/collections.clj
@@ -0,0 +1,4 @@
+{1 "a", "Q" 10} ; commas are treated as whitespace
+(hash-map 1 "a" "Q" 10) ; equivalent to the above
+(let [my-map {1 "a"}]
+  (assoc my-map "Q" 10)) ; "adding" an element
diff --git a/Task/Collections/Forth/collections-2.fth b/Task/Collections/Forth/collections-2.fth
new file mode 100644
index 0000000000..a6d8cc32f5
--- /dev/null
+++ b/Task/Collections/Forth/collections-2.fth
@@ -0,0 +1,7 @@
+include ffl/dcl.fs
+
+dcl-create dl              \ create a double linked list
+
+3   dl dcl-append
+1   dl dcl-prepend
+2 1 dl dcl-insert          \ dl[0] = 1 dl[1] = 2 dl[2] = 3
diff --git a/Task/Collections/Forth/collections-3.fth b/Task/Collections/Forth/collections-3.fth
new file mode 100644
index 0000000000..d07527d84d
--- /dev/null
+++ b/Task/Collections/Forth/collections-3.fth
@@ -0,0 +1,7 @@
+include ffl/hct.fs
+
+10 hct-create ht           \ create a hashtable with initial size 10
+
+1 s" one"   ht hct-insert  \ ht["one"] = 1
+2 s" two"   ht hct-insert  \ ht["two"] = 2
+3 s" three" ht hct-insert  \ ht["three"] = 3
diff --git a/Task/Collections/Forth/collections.fth b/Task/Collections/Forth/collections.fth
new file mode 100644
index 0000000000..0f66cc8821
--- /dev/null
+++ b/Task/Collections/Forth/collections.fth
@@ -0,0 +1,7 @@
+include ffl/car.fs
+
+10 car-create ar           \ create a dynamic array with initial size 10
+
+2 0 ar car-set             \ ar[0] = 2
+3 1 ar car-set             \ ar[1] = 3
+1 0 ar car-insert          \ ar[0] = 1 ar[1] = 2 ar[2] = 3
diff --git a/Task/Collections/Go/collections.go b/Task/Collections/Go/collections.go
new file mode 100644
index 0000000000..5e0923c888
--- /dev/null
+++ b/Task/Collections/Go/collections.go
@@ -0,0 +1,10 @@
+package main
+
+import "fmt"
+
+func main() {
+    var a []interface{}
+    a = append(a, 3)
+    a = append(a, "apples", "oranges")
+    fmt.Println(a)
+}
diff --git a/Task/Collections/Haskell/collections-2.hs b/Task/Collections/Haskell/collections-2.hs
new file mode 100644
index 0000000000..a463d6fdd5
--- /dev/null
+++ b/Task/Collections/Haskell/collections-2.hs
@@ -0,0 +1 @@
+1 : [2, 3, 4]
diff --git a/Task/Collections/Haskell/collections-3.hs b/Task/Collections/Haskell/collections-3.hs
new file mode 100644
index 0000000000..dde2c550e6
--- /dev/null
+++ b/Task/Collections/Haskell/collections-3.hs
@@ -0,0 +1 @@
+[1, 2] ++ [3, 4]
diff --git a/Task/Collections/Haskell/collections-4.hs b/Task/Collections/Haskell/collections-4.hs
new file mode 100644
index 0000000000..437f458660
--- /dev/null
+++ b/Task/Collections/Haskell/collections-4.hs
@@ -0,0 +1 @@
+concat [[1, 2], [3, 4], [5, 6, 7]]
diff --git a/Task/Collections/Haskell/collections.hs b/Task/Collections/Haskell/collections.hs
new file mode 100644
index 0000000000..c9b527da78
--- /dev/null
+++ b/Task/Collections/Haskell/collections.hs
@@ -0,0 +1 @@
+[1, 2, 3, 4, 5]
diff --git a/Task/Collections/Java/collections-2.java b/Task/Collections/Java/collections-2.java
new file mode 100644
index 0000000000..68c93d179f
--- /dev/null
+++ b/Task/Collections/Java/collections-2.java
@@ -0,0 +1,4 @@
+//loop through myarrlist to sum each entry
+for ( i = 0; i < myarrlist.size(); i++) {
+    sum += myarrlist.get(i);
+}
diff --git a/Task/Collections/Java/collections-3.java b/Task/Collections/Java/collections-3.java
new file mode 100644
index 0000000000..a4b9211514
--- /dev/null
+++ b/Task/Collections/Java/collections-3.java
@@ -0,0 +1,3 @@
+for(int i : myarrlist) {
+    sum += i;
+}
diff --git a/Task/Collections/Java/collections-4.java b/Task/Collections/Java/collections-4.java
new file mode 100644
index 0000000000..90ddeeeb1e
--- /dev/null
+++ b/Task/Collections/Java/collections-4.java
@@ -0,0 +1,5 @@
+//remove the last entry in the ArrayList
+myarrlist.remove(myarrlist.size()-1)
+
+//clear the ArrayList
+myarrlist.clear();
diff --git a/Task/Collections/Java/collections.java b/Task/Collections/Java/collections.java
new file mode 100644
index 0000000000..edbbb51ebd
--- /dev/null
+++ b/Task/Collections/Java/collections.java
@@ -0,0 +1,14 @@
+List arrayList = new ArrayList();
+arrayList.add(new Integer(0));
+// alternative with primitive autoboxed to an Integer object automatically
+arrayList.add(0);
+
+//other features of ArrayList
+//define the type in the arraylist, you can substitute a proprietary class in the "<>"
+List myarrlist = new ArrayList();
+
+//add several values to the arraylist to be summed later
+int sum;
+for(int i = 0; i < 10; i++) {
+    myarrlist.add(i);
+}
diff --git a/Task/Collections/JavaScript/collections-2.js b/Task/Collections/JavaScript/collections-2.js
new file mode 100644
index 0000000000..b44f8a4b2d
--- /dev/null
+++ b/Task/Collections/JavaScript/collections-2.js
@@ -0,0 +1,5 @@
+var map = {};
+map['foo'] = 'xyz'; //equivalent to: map.foo = 'xyz';
+map['bar'] = new MyClass; //equivalent to: map.bar = new MyClass;
+map['1x; ~~:-b'] = 'text'; //no equivalent
+alert( map['1x; ~~:-b'] );
diff --git a/Task/Collections/JavaScript/collections.js b/Task/Collections/JavaScript/collections.js
new file mode 100644
index 0000000000..9b6f1dfb34
--- /dev/null
+++ b/Task/Collections/JavaScript/collections.js
@@ -0,0 +1,5 @@
+var array = [];
+array.push('abc');
+array.push(123);
+array.push(new MyClass);
+alert( array[2] );
diff --git a/Task/Collections/Lua/collections.lua b/Task/Collections/Lua/collections.lua
new file mode 100644
index 0000000000..d84584d40b
--- /dev/null
+++ b/Task/Collections/Lua/collections.lua
@@ -0,0 +1,8 @@
+collection = {0, '1'}
+print(collection[1]) -- prints 0
+
+collection = {["foo"] = 0, ["bar"] = '1'} -- a collection of key/value pairs
+print(collection["foo"]) -- prints 0
+print(collection.foo) -- syntactic sugar, also prints 0
+
+collection = {0, '1', ["foo"] = 0, ["bar"] = '1'}
diff --git a/Task/Collections/PHP/collections.php b/Task/Collections/PHP/collections.php
new file mode 100644
index 0000000000..b1b51f1d66
--- /dev/null
+++ b/Task/Collections/PHP/collections.php
@@ -0,0 +1,10 @@
+
diff --git a/Task/Collections/Perl/collections.pl b/Task/Collections/Perl/collections.pl
new file mode 100644
index 0000000000..14ad4ac7ba
--- /dev/null
+++ b/Task/Collections/Perl/collections.pl
@@ -0,0 +1,18 @@
+use strict;
+my @c = (); # create an empty "array" collection
+
+# fill it
+push @c, 10, 11, 12;
+push @c, 65;
+# print it
+print join(" ",@c) . "\n";
+
+# create an empty hash
+my %h = ();
+# add some pair
+$h{'one'} = 1;
+$h{'two'} = 2;
+# print it
+foreach my $i ( keys %h ) {
+    print $i . " -> " . $h{$i} . "\n";
+}
diff --git a/Task/Collections/PicoLisp/collections.l b/Task/Collections/PicoLisp/collections.l
new file mode 100644
index 0000000000..323ac3e6c9
--- /dev/null
+++ b/Task/Collections/PicoLisp/collections.l
@@ -0,0 +1,14 @@
+: (setq Lst (3 4 5 6))
+-> (3 4 5 6)
+
+: (push 'Lst 2)
+-> 2
+
+: (push 'Lst 1)
+-> 1
+
+: Lst
+-> (1 2 3 4 5 6)
+
+: (insert 4 Lst 'X)
+-> (1 2 3 X 4 5 6)
diff --git a/Task/Collections/Python/collections.py b/Task/Collections/Python/collections.py
new file mode 100644
index 0000000000..7b5d22004b
--- /dev/null
+++ b/Task/Collections/Python/collections.py
@@ -0,0 +1,20 @@
+collection = [0, '1']                 # Lists are mutable (editable) and can be sorted in place
+x = collection[0]                     # accessing an item (which happens to be a numeric 0 (zero)
+collection.append(2)                  # adding something to the end of the list
+collection.insert(0, '-1')            # inserting a value into the beginning
+y = collection[0]                     # now returns a string of "-1"
+collection.extend([2,'3'])            # same as [collection.append(i) for i in [2,'3']] ... but faster
+collection += [2,'3']                 # same as previous line
+collection[2:6]                       # a "slice" (collection of the list elements from the third up to but not including the sixth)
+len(collection)                       # get the length of (number of elements in) the collection
+collection = (0, 1)                   # Tuples are immutable (not editable)
+collection[:]                         # ... slices work on these too; and this is equivalent to collection[0:len(collection)]
+collection[-4:-1]                     # negative slices count from the end of the string
+collection[::2]                       # slices can also specify a stride --- this returns all even elements of the collection
+collection="some string"              # strings are treated as sequences of characters
+x = collection[::-1]                  # slice with negative step returns reversed sequence (string in this case).
+collection[::2] == "some string"[::2] # True, literal objects don't need to be bound to name/variable to access slices or object methods
+collection.__getitem__(slice(0,len(collection),2))  # same as previous expressions.
+collection = {0: "zero", 1: "one"}    # Dictionaries (Hash)
+collection['zero'] = 2                # Dictionary members accessed using same syntax as list/array indexes.
+collection = set([0, '1'])            # sets (Hash)
diff --git a/Task/Collections/R/collections-2.r b/Task/Collections/R/collections-2.r
new file mode 100644
index 0000000000..6aa16ca0c2
--- /dev/null
+++ b/Task/Collections/R/collections-2.r
@@ -0,0 +1,2 @@
+integer(5)
+c(1L, -2L, 99L);
diff --git a/Task/Collections/R/collections-3.r b/Task/Collections/R/collections-3.r
new file mode 100644
index 0000000000..352eb94a6c
--- /dev/null
+++ b/Task/Collections/R/collections-3.r
@@ -0,0 +1,2 @@
+logical(5)
+c(TRUE, FALSE)
diff --git a/Task/Collections/R/collections-4.r b/Task/Collections/R/collections-4.r
new file mode 100644
index 0000000000..6b31477a31
--- /dev/null
+++ b/Task/Collections/R/collections-4.r
@@ -0,0 +1,2 @@
+character(5)
+c("abc", "defg", "")
diff --git a/Task/Collections/R/collections-5.r b/Task/Collections/R/collections-5.r
new file mode 100644
index 0000000000..47a7e6223f
--- /dev/null
+++ b/Task/Collections/R/collections-5.r
@@ -0,0 +1,3 @@
+matrix(1:12, nrow=3)
+
+array(1:24, dim=c(2,3,4)) #output not shown
diff --git a/Task/Collections/R/collections-6.r b/Task/Collections/R/collections-6.r
new file mode 100644
index 0000000000..be21cc726e
--- /dev/null
+++ b/Task/Collections/R/collections-6.r
@@ -0,0 +1 @@
+list(a=123, b="abc", TRUE, 1:5, c=list(d=runif(5), e=5+6))
diff --git a/Task/Collections/R/collections-7.r b/Task/Collections/R/collections-7.r
new file mode 100644
index 0000000000..8ccf3f7727
--- /dev/null
+++ b/Task/Collections/R/collections-7.r
@@ -0,0 +1,13 @@
+$a
+[1] 123
+$b
+[1] "abc"
+[[3]]
+[1] TRUE
+[[4]]
+[1] 1 2 3 4 5
+$c
+$c$d
+[1] 0.6013157 0.5011909 0.7106448 0.3882265 0.1274939
+$c$e
+[1] 11
diff --git a/Task/Collections/R/collections-8.r b/Task/Collections/R/collections-8.r
new file mode 100644
index 0000000000..255fe74932
--- /dev/null
+++ b/Task/Collections/R/collections-8.r
@@ -0,0 +1 @@
+data.frame(name=c("Alice", "Bob", "Carol"), age=c(23, 35, 17))
diff --git a/Task/Collections/R/collections.r b/Task/Collections/R/collections.r
new file mode 100644
index 0000000000..97b6009ded
--- /dev/null
+++ b/Task/Collections/R/collections.r
@@ -0,0 +1,3 @@
+numeric(5)
+1:10
+c(1, 3, 6, 10, 7 + 8, sqrt(441))
diff --git a/Task/Collections/REXX/collections-2.rexx b/Task/Collections/REXX/collections-2.rexx
new file mode 100644
index 0000000000..cef7d297b7
--- /dev/null
+++ b/Task/Collections/REXX/collections-2.rexx
@@ -0,0 +1 @@
+ pr.0=14               /*number of entries in the stemmed array.*/
diff --git a/Task/Collections/REXX/collections-3.rexx b/Task/Collections/REXX/collections-3.rexx
new file mode 100644
index 0000000000..3b7de47664
--- /dev/null
+++ b/Task/Collections/REXX/collections-3.rexx
@@ -0,0 +1,5 @@
+  do j=1  while pr.j\==0
+  say  'prime'  j  'is' pr.j
+  end   /*j*/
+                       /*at this point, J=15. */
+j=j-1                  /*J now has the count of primes stored.*/
diff --git a/Task/Collections/REXX/collections-4.rexx b/Task/Collections/REXX/collections-4.rexx
new file mode 100644
index 0000000000..5ecda68351
--- /dev/null
+++ b/Task/Collections/REXX/collections-4.rexx
@@ -0,0 +1,10 @@
+primeList='2 3 5 7 11 13 17 19 23 29 31 37 41 43'    /* or ...  */
+primeList= 2 3 5 7 11 13 17 19 23 29 31 37 41 43
+
+                    /*in this case, the quotes (') can be dropped. */
+
+primes=words(primeList)
+
+  do j=1  for primes      /*can also be coded:    do j=1 to primes */
+  say 'prime' j 'is' word(primeList,j)
+  end   /*j*/
diff --git a/Task/Collections/REXX/collections-5.rexx b/Task/Collections/REXX/collections-5.rexx
new file mode 100644
index 0000000000..6273548cf3
--- /dev/null
+++ b/Task/Collections/REXX/collections-5.rexx
@@ -0,0 +1,31 @@
+pr.=0        /*define a default for all elements for the stemmed array.*/
+pr.2 =1
+pr.3 =1
+pr.5 =1
+pr.7 =1
+pr.11=1
+pr.13=1
+pr.17=1
+pr.19=1
+pr.23=1
+pr.29=1
+pr.31=1
+pr.37=1
+pr.41=1
+pr.43=1
+
+primes=0
+           do j=1  for 10000          /*this method isn't very efficent*/
+           if pr.j==0  then iterate
+           primes=primes+1
+           end   /*j*/
+
+say '# of primes in list:' primes
+
+Ps=0                                  /*another inefficient method.    */
+           do k=1  for 10000          /*this method isn't very efficent*/
+           Ps = Ps + (pn.k\==0)       /*more obtuse, if ya like that.  */
+           say 'prime' Ps "is:" k     /*might as well echo the prime #.*/
+           end   /*k*/
+
+say 'number of primes found in the list is' Ps
diff --git a/Task/Collections/REXX/collections.rexx b/Task/Collections/REXX/collections.rexx
new file mode 100644
index 0000000000..4070a88609
--- /dev/null
+++ b/Task/Collections/REXX/collections.rexx
@@ -0,0 +1,36 @@
+pr.=0        /*define a default for all elements for the stemmed array.*/
+
+pr.1 =2                    /*note that this array starts at  1  (one). */
+pr.2 =3
+pr.3 =5
+pr.4 =7
+pr.6 =11
+pr.6 =13
+pr.7 =17
+pr.8 =19
+pr.9 =23
+pr.10=29
+pr.11=31
+pr.12=37
+pr.13=41
+pr.14=43
+
+y.=0                       /*define a default for all years.           */
+y.1985 =  6020
+y.1986 =  7791
+y.1987 =  8244
+y.1988 = 10075
+x = y.2000                 /*X will have a value of zero (0).          */
+
+fib.0 = 0                  /*arrays may start with  zero (0).          */
+fib.1 = 1
+fib.2 = 1
+fib.3 = 2
+fib.4 = 3
+fib.5 = 5
+fib.6 = 8
+fib.7 =17
+
+   do n=-5  to 5           /*define an array from  -5  ──►  5          */
+   sawtooth.n=n
+   end   /*n*/             /*eleven elements will be defined.          */
diff --git a/Task/Collections/Ruby/collections-2.rb b/Task/Collections/Ruby/collections-2.rb
new file mode 100644
index 0000000000..437bb285a6
--- /dev/null
+++ b/Task/Collections/Ruby/collections-2.rb
@@ -0,0 +1,9 @@
+# creating an empty hash
+
+h = {}            # => {}
+h["a"] = 1        # => {"a" => 1}
+h["test"] = 2.4   # => {"a" => 1, "test" => 2.4}
+h[3] = "Hello"    # => {"a" => 1, "test" => 2.4, 3 => "Hello"}
+
+# creating a hash with the constructor
+h = Hash.new      # => {}
diff --git a/Task/Collections/Ruby/collections.rb b/Task/Collections/Ruby/collections.rb
new file mode 100644
index 0000000000..8ff9b3b5a0
--- /dev/null
+++ b/Task/Collections/Ruby/collections.rb
@@ -0,0 +1,8 @@
+# creating an empty array and adding values
+
+a = []            # => []
+a[0] = 1          # => [1]
+a[3] = 2          # => [1, nil, nil, 2]
+
+# creating an array with the constructor
+a = Array.new     # => []
diff --git a/Task/Collections/Scala/collections.scala b/Task/Collections/Scala/collections.scala
new file mode 100644
index 0000000000..5b651fe815
--- /dev/null
+++ b/Task/Collections/Scala/collections.scala
@@ -0,0 +1,37 @@
+scala> // Immutable collections do not change the original object
+scala> // A List
+scala> val list = Nil // Empty List
+list: scala.collection.immutable.Nil.type = List()
+scala> val list2 = List(1, 2) // List with two elements
+list2: List[Int] = List(1, 2)
+scala> val list3 = 3 :: list2 // prepend 3 to list2, using a special operator
+list3: List[Int] = List(3, 1, 2)
+scala> // A Set
+scala> val set = Set.empty[Char] // Empty Set of Char type
+set: scala.collection.immutable.Set[Char] = Set()
+scala> val set1 = set + 'c' // add an element
+set1: scala.collection.immutable.Set[Char] = Set(c)
+scala> // A Map
+scala> val map = Map(1 -> "A")
+map: scala.collection.immutable.Map[Int,java.lang.String] = Map(1 -> A)
+scala> val map1 = map + (2 -> "Map")
+map1: scala.collection.immutable.Map[Int,java.lang.String] = Map(1 -> A, 2 -> Map)
+scala> // Mutable collections can be modified
+scala> val queue = new scala.collection.mutable.Queue[Int]
+queue: scala.collection.mutable.Queue[Int] = Queue()
+scala> queue += 4
+res0: queue.type = Queue(4)
+scala> queue += 5
+res1: queue.type = Queue(4, 5)
+scala> queue
+res2: scala.collection.mutable.Queue[Int] = Queue(4, 5)
+scala> val set = scala.collection.mutable.Set('a')
+set: scala.collection.mutable.Set[Char] = Set(a)
+scala> set += 'b'
+res3: set.type = Set(b, a)
+scala> val map = scala.collection.mutable.Map(1 -> "one")
+map: scala.collection.mutable.Map[Int,java.lang.String] = Map(1 -> one)
+scala> map += (2 -> "two")
+res4: map.type = Map(2 -> two, 1 -> one)
+scala> map
+res5: scala.collection.mutable.Map[Int,java.lang.String] = Map(2 -> two, 1 -> one)
diff --git a/Task/Collections/Scheme/collections-2.ss b/Task/Collections/Scheme/collections-2.ss
new file mode 100644
index 0000000000..77bf873951
--- /dev/null
+++ b/Task/Collections/Scheme/collections-2.ss
@@ -0,0 +1,4 @@
+(display (list 1 2 3))
+(newline)
+(display (list))
+(newline)
diff --git a/Task/Collections/Scheme/collections-3.ss b/Task/Collections/Scheme/collections-3.ss
new file mode 100644
index 0000000000..6ca29fc6e0
--- /dev/null
+++ b/Task/Collections/Scheme/collections-3.ss
@@ -0,0 +1,2 @@
+(1 2 3)
+()
diff --git a/Task/Collections/Scheme/collections-4.ss b/Task/Collections/Scheme/collections-4.ss
new file mode 100644
index 0000000000..081b053898
--- /dev/null
+++ b/Task/Collections/Scheme/collections-4.ss
@@ -0,0 +1 @@
+(cons obj lst)
diff --git a/Task/Collections/Scheme/collections-5.ss b/Task/Collections/Scheme/collections-5.ss
new file mode 100644
index 0000000000..8447867de2
--- /dev/null
+++ b/Task/Collections/Scheme/collections-5.ss
@@ -0,0 +1,2 @@
+(display (cons 0 (list 1 2 3)))
+(newline)
diff --git a/Task/Collections/Scheme/collections-6.ss b/Task/Collections/Scheme/collections-6.ss
new file mode 100644
index 0000000000..78efe5d71b
--- /dev/null
+++ b/Task/Collections/Scheme/collections-6.ss
@@ -0,0 +1 @@
+(0 1 2 3)
diff --git a/Task/Collections/Scheme/collections-7.ss b/Task/Collections/Scheme/collections-7.ss
new file mode 100644
index 0000000000..51b630f818
--- /dev/null
+++ b/Task/Collections/Scheme/collections-7.ss
@@ -0,0 +1 @@
+(append lst ...)
diff --git a/Task/Collections/Scheme/collections-8.ss b/Task/Collections/Scheme/collections-8.ss
new file mode 100644
index 0000000000..420c173fcc
--- /dev/null
+++ b/Task/Collections/Scheme/collections-8.ss
@@ -0,0 +1,2 @@
+(display (append (list 1 2 3) (list 4 5 6)))
+(newline)
diff --git a/Task/Collections/Scheme/collections-9.ss b/Task/Collections/Scheme/collections-9.ss
new file mode 100644
index 0000000000..c319ae6800
--- /dev/null
+++ b/Task/Collections/Scheme/collections-9.ss
@@ -0,0 +1 @@
+(1 2 3 4 5 6)
diff --git a/Task/Collections/Scheme/collections.ss b/Task/Collections/Scheme/collections.ss
new file mode 100644
index 0000000000..8b3210d122
--- /dev/null
+++ b/Task/Collections/Scheme/collections.ss
@@ -0,0 +1 @@
+(list obj ...)
diff --git a/Task/Collections/Smalltalk/collections.st b/Task/Collections/Smalltalk/collections.st
new file mode 100644
index 0000000000..850f0b5da8
--- /dev/null
+++ b/Task/Collections/Smalltalk/collections.st
@@ -0,0 +1,32 @@
+|anOrdered aBag aSet aSorted aSorted2 aDictionary|
+
+anOrdered := OrderedCollection new.
+anOrdered add: 1; add: 5; add: 3.
+anOrdered printNl.
+
+aBag := Bag new.
+aBag add: 5; add: 5; add: 5; add: 6.
+aBag printNl.
+
+aSet := Set new.
+aSet add: 10; add: 5; add: 5; add: 6; add: 10.
+aSet printNl.
+
+aSorted := SortedCollection new.
+aSorted add: 10; add: 9; add: 8; add: 5.
+aSorted printNl.
+
+"another sorted with custom comparator: let's sort
+ the other collections according to their size (number of
+ elements)"
+aSorted2 := SortedCollection sortBlock: [ :a :b |
+    (a size) < (b size) ].
+aSorted2 add: anOrdered; add: aBag; add: aSet; add: aSorted.
+aSorted2 printNl.
+
+aDictionary := Dictionary new.
+aDictionary at: 'OrderedCollection' put: anOrdered;
+            at: 'Bag' put: aBag;
+            at: 'Set' put: aSet;
+            at: 'SortedCollection' put: { aSorted. aSorted2 }.
+aDictionary printNl.
diff --git a/Task/Collections/Tcl/collections-2.tcl b/Task/Collections/Tcl/collections-2.tcl
new file mode 100644
index 0000000000..b33eef789d
--- /dev/null
+++ b/Task/Collections/Tcl/collections-2.tcl
@@ -0,0 +1,24 @@
+# create an empty array
+array set h {}
+# add some pair
+set h(one) 1
+set h(two) 2
+# add more data
+array set h {three 3 four 4 more {5 6 7 8}}
+# iterate over it in a couple of ways
+foreach key [array names h] {puts "$key -> $h($key)"}
+foreach {key value} [array get h]  {puts "$key -> $value"}
+
+# pass by name
+proc numkeys_byname {arrayName} {
+    upvar 1 $arrayName arr
+    puts "array $arrayName has [llength [array names arr]] keys"
+}
+numkeys_byname h
+
+# pass serialized
+proc numkeys_bycopy {l} {
+    array set arr $l
+    puts "array has [llength [array names arr]] keys"
+}
+numkeys_bycopy [array get h]
diff --git a/Task/Collections/Tcl/collections-3.tcl b/Task/Collections/Tcl/collections-3.tcl
new file mode 100644
index 0000000000..24f62cf1e1
--- /dev/null
+++ b/Task/Collections/Tcl/collections-3.tcl
@@ -0,0 +1,9 @@
+# create an empty dictionary
+set d [dict create]
+dict set d one 1
+dict set d two 2
+# create another
+set e [dict create three 3 four 4]
+set f [dict merge $d $e]
+dict set f nested [dict create five 5 more [list 6 7 8]]
+puts [dict get $f nested more] ;# ==> 6 7 8
diff --git a/Task/Collections/Tcl/collections.tcl b/Task/Collections/Tcl/collections.tcl
new file mode 100644
index 0000000000..28fce4fe09
--- /dev/null
+++ b/Task/Collections/Tcl/collections.tcl
@@ -0,0 +1,12 @@
+set c [list] ;# create an empty list
+# fill it
+lappend c 10 11 13
+set c [linsert $c 2 "twelve goes here"]
+# iterate over it
+foreach elem $c {puts $elem}
+
+# pass to a proc
+proc show_size {l} {
+    puts [llength $l]
+}
+show_size $c
diff --git a/Task/Color_of_a_screen_pixel/0DESCRIPTION b/Task/Color_of_a_screen_pixel/0DESCRIPTION
new file mode 100644
index 0000000000..87d1c9bbc6
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/0DESCRIPTION
@@ -0,0 +1 @@
+Get color information from an arbitrary pixel on the screen, such as the current location of the mouse cursor.  The mouse cursor may or may not have to be active in a GUI created by your program.  These functions are OS related.
diff --git a/Task/Color_of_a_screen_pixel/1META.yaml b/Task/Color_of_a_screen_pixel/1META.yaml
new file mode 100644
index 0000000000..b5b7d9296e
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/1META.yaml
@@ -0,0 +1,4 @@
+---
+category:
+- Testing
+note: GUI
diff --git a/Task/Color_of_a_screen_pixel/BASIC/color_of_a_screen_pixel.bas b/Task/Color_of_a_screen_pixel/BASIC/color_of_a_screen_pixel.bas
new file mode 100644
index 0000000000..ab00b6f9c0
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/BASIC/color_of_a_screen_pixel.bas
@@ -0,0 +1 @@
+color = point(x, y)
diff --git a/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel-2.c b/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel-2.c
new file mode 100644
index 0000000000..f0edd20b7f
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel-2.c
@@ -0,0 +1,26 @@
+#include 
+
+COLORREF getColorAtCursor(void) {
+    POINT p;
+    COLORREF color;
+    HDC hDC;
+    BOOL b;
+
+    /* Get the device context for the screen */
+    hDC = GetDC(NULL);
+    if (hDC == NULL)
+        return CLR_INVALID;
+
+    /* Get the current cursor position */
+    b = GetCursorPos(&p);
+    if (!b)
+        return CLR_INVALID;
+
+    /* Retrieve the color at that position */
+    color = GetPixel(hDC, p.x, p.y);
+
+    /* Release the device context again */
+    ReleaseDC(GetDesktopWindow(), hDC);
+
+    return color;
+}
diff --git a/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel.c b/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel.c
new file mode 100644
index 0000000000..df27509786
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/C/color_of_a_screen_pixel.c
@@ -0,0 +1,15 @@
+#include 
+void
+get_pixel_color (Display *d, int x, int y, XColor *color)
+{
+  XImage *image;
+  image = XGetImage (d, RootWindow (d, DefaultScreen (d)), x, y, 1, 1, AllPlanes, XYPixmap);
+  color->pixel = XGetPixel (image, 0, 0);
+  XFree (image);
+  XQueryColor (d, DefaultColormap(d, DefaultScreen (d)), color);
+}
+
+// Your code
+XColor c;
+get_pixel_color (display, 30, 40, &c);
+printf ("%d %d %d\n", c.red, c.green, c.blue);
diff --git a/Task/Color_of_a_screen_pixel/Clojure/color_of_a_screen_pixel.clj b/Task/Color_of_a_screen_pixel/Clojure/color_of_a_screen_pixel.clj
new file mode 100644
index 0000000000..a93bf30d3d
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Clojure/color_of_a_screen_pixel.clj
@@ -0,0 +1,2 @@
+(defn get-color-at [x y]
+  (.getPixelColor (java.awt.Robot.) x y))
diff --git a/Task/Color_of_a_screen_pixel/Java/color_of_a_screen_pixel.java b/Task/Color_of_a_screen_pixel/Java/color_of_a_screen_pixel.java
new file mode 100644
index 0000000000..1585bc5369
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Java/color_of_a_screen_pixel.java
@@ -0,0 +1,3 @@
+public static Color getColorAt(int x, int y){
+   return new Robot().getPixelColor(x, y);
+}
diff --git a/Task/Color_of_a_screen_pixel/PHP/color_of_a_screen_pixel.php b/Task/Color_of_a_screen_pixel/PHP/color_of_a_screen_pixel.php
new file mode 100644
index 0000000000..972a7a8e3e
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/PHP/color_of_a_screen_pixel.php
@@ -0,0 +1,3 @@
+$img = imagegrabscreen();
+$color = imagecolorat($im, 10, 50);
+imagedestroy($im);
diff --git a/Task/Color_of_a_screen_pixel/PicoLisp/color_of_a_screen_pixel.l b/Task/Color_of_a_screen_pixel/PicoLisp/color_of_a_screen_pixel.l
new file mode 100644
index 0000000000..7dc7c09031
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/PicoLisp/color_of_a_screen_pixel.l
@@ -0,0 +1,2 @@
+(in '(grabc)
+   (mapcar hex (cdr (line NIL 1 2 2 2))) )
diff --git a/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-2.py b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-2.py
new file mode 100644
index 0000000000..487d260c9c
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-2.py
@@ -0,0 +1,5 @@
+def get_pixel_colour(i_x, i_y):
+	import PIL.ImageGrab
+	return PIL.ImageGrab.grab().load()[i_x, i_y]
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-3.py b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-3.py
new file mode 100644
index 0000000000..dbd94fde84
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-3.py
@@ -0,0 +1,11 @@
+def get_pixel_colour(i_x, i_y):
+	import PIL.Image # python-imaging
+	import PIL.ImageStat # python-imaging
+	import Xlib.display # python-xlib
+	o_x_root = Xlib.display.Display().screen().root
+	o_x_image = o_x_root.get_image(i_x, i_y, 1, 1, Xlib.X.ZPixmap, 0xffffffff)
+	o_pil_image_rgb = PIL.Image.fromstring("RGB", (1, 1), o_x_image.data, "raw", "BGRX")
+	lf_colour = PIL.ImageStat.Stat(o_pil_image_rgb).mean
+	return tuple(map(int, lf_colour))
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-4.py b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-4.py
new file mode 100644
index 0000000000..e86a158555
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-4.py
@@ -0,0 +1,7 @@
+def get_pixel_colour(i_x, i_y):
+	import gtk # python-gtk2
+	o_gdk_pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 1, 1)
+	o_gdk_pixbuf.get_from_drawable(gtk.gdk.get_default_root_window(), gtk.gdk.colormap_get_system(), i_x, i_y, 0, 0, 1, 1)
+	return tuple(o_gdk_pixbuf.get_pixels_array().tolist()[0][0])
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-5.py b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-5.py
new file mode 100644
index 0000000000..f374f5256b
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel-5.py
@@ -0,0 +1,9 @@
+def get_pixel_colour(i_x, i_y):
+	import PyQt4.QtGui # python-qt4
+	app = PyQt4.QtGui.QApplication([])
+	long_qdesktop_id = PyQt4.QtGui.QApplication.desktop().winId()
+	long_colour = PyQt4.QtGui.QPixmap.grabWindow(long_qdesktop_id, i_x, i_y, 1, 1).toImage().pixel(0, 0)
+	i_colour = int(long_colour)
+	return ((i_colour >> 16) & 0xff), ((i_colour >> 8) & 0xff), (i_colour & 0xff)
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel.py b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel.py
new file mode 100644
index 0000000000..74f56cb70d
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Python/color_of_a_screen_pixel.py
@@ -0,0 +1,9 @@
+def get_pixel_colour(i_x, i_y):
+	import win32gui
+	i_desktop_window_id = win32gui.GetDesktopWindow()
+	i_desktop_window_dc = win32gui.GetWindowDC(i_desktop_window_id)
+	long_colour = win32gui.GetPixel(i_desktop_window_dc, i_x, i_y)
+	i_colour = int(long_colour)
+	return (i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff)
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color_of_a_screen_pixel/Tcl/color_of_a_screen_pixel.tcl b/Task/Color_of_a_screen_pixel/Tcl/color_of_a_screen_pixel.tcl
new file mode 100644
index 0000000000..1a9d5d3894
--- /dev/null
+++ b/Task/Color_of_a_screen_pixel/Tcl/color_of_a_screen_pixel.tcl
@@ -0,0 +1,22 @@
+package require Tcl 8.5
+package require Tk
+
+# Farm out grabbing the screen to an external program.
+# If it was just for a Tk window, we'd use the tkimg library instead
+proc grabScreen {image} {
+    set pipe [open {|xwd -root -silent | convert xwd:- ppm:-} rb]
+    $image put [read $pipe]
+    close $pipe
+}
+# Get the RGB data for a particular pixel (global coords)
+proc getPixelAtPoint {x y} {
+    set buffer [image create photo]
+    grabScreen $buffer
+    set data [$image get $x $y]
+    image delete $buffer
+    return $data
+}
+
+# Demo...
+puts [format "pixel at mouse: (%d,%d,%d)" \
+    {*}[getPixelAtPoint {*}[winfo pointerxy .]]]
diff --git a/Task/Deepcopy/0DESCRIPTION b/Task/Deepcopy/0DESCRIPTION
new file mode 100644
index 0000000000..d8acd3bf9d
--- /dev/null
+++ b/Task/Deepcopy/0DESCRIPTION
@@ -0,0 +1,13 @@
+Demonstrate how to copy data structures containing complex hetrogeneous and cyclic semantics. This is often referred to as [[wp:Deep_copy#Deep_copy|deep copying]], and is normally required where structures are mutable and to ensure that independent copies can be manipulated without side-effects.
+
+If this facility is not built into the language, it is permissible to use functions from a common library, or a coded procedure.
+
+The task should show:
+
+* Relevant semantics of structures, such as their [[wp:Homogeneity and heterogeneity|homogeneous or heterogeneous]] properties, or containment of (self- or mutual-reference) cycles.
+
+* Any limitations of the method.
+
+* That the structure and its copy are different.
+
+* Suitable links to external documentation for common libraries.
diff --git a/Task/Deepcopy/Go/deepcopy-2.go b/Task/Deepcopy/Go/deepcopy-2.go
new file mode 100644
index 0000000000..1da88fa9cc
--- /dev/null
+++ b/Task/Deepcopy/Go/deepcopy-2.go
@@ -0,0 +1,62 @@
+package main
+
+import (
+    "encoding/gob"
+    "fmt"
+    "os"
+)
+
+// capability requested by task
+func deepcopy(dst, src interface{}) error {
+    r, w, err := os.Pipe()
+    if err != nil {
+        return err
+    }
+    enc := gob.NewEncoder(w)
+    err = enc.Encode(src)
+    if err != nil {
+        return err
+    }
+    dec := gob.NewDecoder(r)
+    return dec.Decode(dst)
+}
+
+// define linked list type, an example of a recursive type
+type link struct {
+    Value string
+    Next  *link
+}
+
+// method satisfies stringer interface for fmt.Println
+func (l *link) String() string {
+    if l == nil {
+        return "nil"
+    }
+    s := "(" + l.Value
+    for l = l.Next; l != nil; l = l.Next {
+        s += " " + l.Value
+    }
+    return s + ")"
+}
+
+func main() {
+    // create a linked list with two elements
+    l1 := &link{"a", &link{Value: "b"}}
+    // print original
+    fmt.Println(l1)
+    // declare a variable to hold deep copy
+    var l2 *link
+    // copy
+    if err := deepcopy(&l2, l1); err != nil {
+        fmt.Println(err)
+        return
+    }
+    // print copy
+    fmt.Println(l2)
+    // now change contents of original list
+    l1.Value, l1.Next.Value = "c", "d"
+    // show that it is changed
+    fmt.Println(l1)
+    // show that copy is unaffected
+    fmt.Println(l2)
+}
diff --git a/Task/Deepcopy/Go/deepcopy.go b/Task/Deepcopy/Go/deepcopy.go
new file mode 100644
index 0000000000..a9af758f5a
--- /dev/null
+++ b/Task/Deepcopy/Go/deepcopy.go
@@ -0,0 +1,37 @@
+package main
+
+import "fmt"
+
+// a complex data structure
+type cds struct {
+    i int            // no special handling needed for deep copy
+    s string         // no special handling
+    b []byte         // copied easily with append function
+    m map[int]bool   // deep copy requires looping
+}
+
+// a method
+func (c cds) deepcopy() *cds {
+    // copy what you can in one line
+    r := &cds{c.i, c.s, append([]byte{}, c.b...), make(map[int]bool)}
+    // populate map with a loop
+    for k, v := range c.m {
+        r.m[k] = v
+    }
+    return r
+}
+
+// demo
+func main() {
+    // create and populate a structure
+    c1 := &cds{1, "one", []byte("unit"), map[int]bool{1: true}}
+    fmt.Println(c1)      // show it
+    c2 := c1.deepcopy()  // copy it
+    fmt.Println(c2)      // show copy
+    c1.i = 0             // change original
+    c1.s = "nil"
+    copy(c1.b, "zero")
+    c1.m[1] = false
+    fmt.Println(c1)      // show changes
+    fmt.Println(c2)      // show copy unaffected
+}
diff --git a/Task/Deepcopy/JavaScript/deepcopy-2.js b/Task/Deepcopy/JavaScript/deepcopy-2.js
new file mode 100644
index 0000000000..cb86c0a33a
--- /dev/null
+++ b/Task/Deepcopy/JavaScript/deepcopy-2.js
@@ -0,0 +1,8 @@
+var deepcopy = function(o){
+  return eval(uneval(o));
+};
+var src = {foo:0,bar:[0,1]};
+src['baz'] = src;
+print(uneval(src));
+var dst = deepcopy(src);
+print(uneval(src));
diff --git a/Task/Deepcopy/JavaScript/deepcopy.js b/Task/Deepcopy/JavaScript/deepcopy.js
new file mode 100644
index 0000000000..afd192275b
--- /dev/null
+++ b/Task/Deepcopy/JavaScript/deepcopy.js
@@ -0,0 +1,8 @@
+var deepcopy = function(o){
+  return JSON.parse(JSON.stringify(src));
+};
+
+var src = {foo:0,bar:[0,1]};
+print(JSON.stringify(src));
+var dst = deepcopy(src);
+print(JSON.stringify(src));
diff --git a/Task/Define_a_primitive_data_type/0DESCRIPTION b/Task/Define_a_primitive_data_type/0DESCRIPTION
new file mode 100644
index 0000000000..8ae8a5e4ed
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/0DESCRIPTION
@@ -0,0 +1,3 @@
+{{omit from|BBC BASIC}}
+[[Category:Type System]]
+Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. Include all bounds checking you need to write, or explain how the compiler or interpreter creates those bounds checks for you.
diff --git a/Task/Define_a_primitive_data_type/1META.yaml b/Task/Define_a_primitive_data_type/1META.yaml
new file mode 100644
index 0000000000..659c8686af
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Basic language learning
diff --git a/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type-2.f b/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type-2.f
new file mode 100644
index 0000000000..5ef105b3a2
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type-2.f
@@ -0,0 +1,25 @@
+program BoundedTest
+  use Bounded
+  implicit none
+
+  type(BoundedInteger)     ::  a, b, c
+
+  call set_bound(a, 1, 10)
+  ! if we want to stop the program if a is out of bounds...
+  ! call set_bound(a, 1, 10, critical=.true.)
+  call set_bound(b, 1, 10)
+  call set_bound(c, 1, 10)
+  ! if we want to init c to a specific value...:
+  ! call set_bound(c, 1, 10, value=6)
+
+  a = 1         ! ok
+  a = 4         ! ok
+  a = -1        ! warning (a=1)
+  a = 11        ! warning (a=10)
+  a = 3         ! ok
+  b = a         ! ok
+  c = a + b     ! ok (3+3)
+  c = c + a     ! ok (6+3=9)
+  c = c + b     ! warning (c=10)
+
+end program BoundedTest
diff --git a/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type.f b/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type.f
new file mode 100644
index 0000000000..212c6a3eb5
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Fortran/define_a_primitive_data_type.f
@@ -0,0 +1,102 @@
+module Bounded
+  implicit none
+
+  type BoundedInteger
+     integer, private :: v         ! we cannot allow direct access to this, or we
+     integer, private :: from, to  !   can't check the bounds!
+     logical, private :: critical
+  end type BoundedInteger
+
+  interface assignment(=)
+     module procedure bounded_assign_bb, bounded_assign_bi !, &
+                    ! bounded_assign_ib
+  end interface
+
+  interface operator(+)
+     module procedure bounded_add_bbb !, bounded_add_bbi, &
+                    ! bounded_add_bib, bounded_add_ibb,   &
+                    ! bounded_add_iib, bounded_add_ibi,   &
+                    ! bounded_add_bii
+  end interface
+
+  private :: bounded_assign_bb, bounded_assign_bi, &
+             bounded_add_bbb
+
+contains
+
+  subroutine set_bound(bi, lower, upper, critical, value)
+    type(BoundedInteger), intent(out) :: bi
+    integer, intent(in) :: lower, upper
+    integer, intent(in), optional :: value
+    logical, intent(in), optional :: critical
+
+    bi%from = min(lower, upper)
+    bi%to = max(lower, upper)
+    if ( present(critical) ) then
+       bi%critical = critical
+    else
+       bi%critical = .false.
+    end if
+    if ( present(value) ) then
+       bi = value
+    end if
+  end subroutine set_bound
+
+  subroutine bounded_assign_bb(a, b)
+    type(BoundedInteger), intent(out) :: a
+    type(BoundedInteger), intent(in)  :: b
+
+    call bounded_assign_bi(a, b%v)
+
+  end subroutine bounded_assign_bb
+
+
+  subroutine bounded_assign_bi(a, b)
+    type(BoundedInteger), intent(out) :: a
+    integer,              intent(in)  :: b
+
+    if ( (a%from <= b) .and. (a%to >= b) ) then
+       a%v = b
+    else
+       write(0,*) "BoundedInteger: out of bound assignment"
+       if ( a%critical ) then
+          stop
+       else
+          if ( b < a%from ) then
+             a%v = a%from
+          else
+             a%v = a%to
+          end if
+          write(0,"(A,' (',I0, ')')") "BoundedInteger: set to nearest bound", a%v
+       end if
+    end if
+  end subroutine bounded_assign_bi
+
+
+  function bounded_add_bbb(a, b) result(c)
+    type(BoundedInteger) :: c
+    type(BoundedInteger), intent(in) :: a, b
+
+    integer :: t
+
+    c%from = max(a%from, b%from)
+    c%to   = min(a%to,   b%to)
+    t = a%v + b%v
+    if ( c%from <= t .and. c%to >= t ) then
+       c%v = t
+    else
+       write(0,*) "BoundedInteger: out of bound sum"
+       if ( a%critical .or. b%critical ) then
+          stop
+       else
+          if ( t < c%from ) then
+             c%v = c%from
+          else
+             c%v = c%to
+          end if
+          write(0,"(A,' (',I0,')')") "BoundedInteger: set to nearest bound", c%v
+       end if
+    end if
+  end function bounded_add_bbb
+
+end module Bounded
diff --git a/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-2.hs b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-2.hs
new file mode 100644
index 0000000000..6d90997708
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-2.hs
@@ -0,0 +1,5 @@
+newtype TinyInt = TinyInt Int
+
+instance Checked TinyInt Int where
+  check x | x >= 0 && x <= 10  =  Check x
+          | otherwise          =  error "Out of range"
diff --git a/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-3.hs b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-3.hs
new file mode 100644
index 0000000000..cea46cc875
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type-3.hs
@@ -0,0 +1,5 @@
+newtype EvenInt = EvenInt Int
+
+ instance Checked EvenInt Int where
+   check x | even x     =  Check x
+           | otherwise  =  error "Not even"
diff --git a/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type.hs b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type.hs
new file mode 100644
index 0000000000..aabf0333d6
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Haskell/define_a_primitive_data_type.hs
@@ -0,0 +1,44 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+data Check a b = Check { unCheck :: b } deriving (Eq, Ord)
+
+class Checked a b where
+  check :: b -> Check a b
+
+lift  f x = f (unCheck x)
+liftc f x = check $ f (unCheck x)
+
+lift2  f x y = f (unCheck x) (unCheck y)
+lift2c f x y = check $ f (unCheck x) (unCheck y)
+lift2p f x y = (check u, check v) where (u,v) = f (unCheck x) (unCheck y)
+
+instance Show b => Show (Check a b) where
+  show (Check x)        = show x
+  showsPrec p (Check x) = showsPrec p x
+
+instance (Enum b, Checked a b) => Enum (Check a b) where
+  succ = liftc succ
+  pred = liftc pred
+  toEnum   = check . toEnum
+  fromEnum = lift fromEnum
+
+instance (Num b, Checked a b) => Num (Check a b) where
+  (+) = lift2c (+)
+  (-) = lift2c (-)
+  (*) = lift2c (*)
+ negate = liftc negate
+  abs    = liftc abs
+   signum = liftc signum
+  fromInteger = check . fromInteger
+
+instance (Real b, Checked a b) => Real (Check a b) where
+  toRational = lift toRational
+
+instance (Integral b, Checked a b) => Integral (Check a b) where
+  quot = lift2c quot
+  rem  = lift2c rem
+  div  = lift2c div
+  mod  = lift2c mod
+  quotRem = lift2p quotRem
+  divMod  = lift2p divMod
+  toInteger = lift toInteger
diff --git a/Task/Define_a_primitive_data_type/Java/define_a_primitive_data_type.java b/Task/Define_a_primitive_data_type/Java/define_a_primitive_data_type.java
new file mode 100644
index 0000000000..4be0e1ddfc
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Java/define_a_primitive_data_type.java
@@ -0,0 +1,71 @@
+class BoundedIntOutOfBoundsException extends Exception
+{
+  public BoundedIntOutOfBoundsException(int v, int l, int u) {
+    super("value " + v + " is out of bounds [" + l + "," + u + "]");
+  }
+}
+
+class BoundedInt {
+  private int value;
+  private int lower;
+  private int upper;
+
+  public BoundedInt(int l, int u) {
+    lower = Math.min(l, u);
+    upper = Math.max(l, u);
+  }
+
+  private boolean checkBounds(int v) {
+    return (v >= this.lower) && (v <= this.upper);
+  }
+
+  public void assign(BoundedInt i) throws BoundedIntOutOfBoundsException {{
+    assign(i.value()); //could still throw Exception if the other BoundedInt has different bounds
+  }
+
+  public void assign(int v) throws BoundedIntOutOfBoundsException {
+    if ( checkBounds(v) ) {
+      this.value = v;
+    } else {
+      throw new BoundedIntOutOfBoundsException(v, this.lower, this.upper);
+    }
+  }
+
+  public int add(BoundedInt i) throws BoundedIntOutOfBoundsException {
+    return add(i.value());
+  }
+
+  public int add(int i) throws BoundedIntOutOfBoundsException {
+    if ( checkBounds(this.value + i) ) {
+      this.value += i;
+    }  else {
+      throw new BoundedIntOutOfBoundsException(this.value + i, this.lower, this.upper);
+    }
+    return this.value;
+  }
+
+  public int value() {
+    return this.value;
+  }
+}
+
+
+public class Bounded {
+  public static void main(String[] args) throws BoundedIntOutOfBoundsException {
+    BoundedInt a = new BoundedInt(1, 10);
+    BoundedInt b = new BoundedInt(1, 10);
+
+    a.assign(6);
+    try {
+      b.assign(12);
+    } catch (Exception e) {
+      System.out.println(e.getMessage());
+    }
+    b.assign(9);
+    try {
+      a.add(b.value());
+    } catch (Exception e) {
+      System.out.println(e.getMessage());
+    }
+  }
+}
diff --git a/Task/Define_a_primitive_data_type/JavaScript/define_a_primitive_data_type.js b/Task/Define_a_primitive_data_type/JavaScript/define_a_primitive_data_type.js
new file mode 100644
index 0000000000..74108fa46a
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/JavaScript/define_a_primitive_data_type.js
@@ -0,0 +1,22 @@
+function Num(n){
+    n = Math.floor(n);
+    if(isNaN(n))
+        throw new TypeError("Not a Number");
+    if(n < 1 || n > 10)
+        throw new TypeError("Out of range");
+    this._value = n;
+}
+Num.prototype.valueOf = function() { return this._value; }
+Num.prototype.toString = function () { return this._value.toString();}
+
+var w = new Num(3), x = new Num(4);
+
+WScript.Echo(w + x); //7
+WScript.Echo(x - w); //1
+WScript.Echo(w * x); //12
+WScript.Echo(w / x); //0.75
+WScript.Echo(w < x); //true
+WScript.Echo(x < w); //false
+
+var y = new Num(0); //TypeError
+var z = new Num(11); //TypeError
diff --git a/Task/Define_a_primitive_data_type/Perl/define_a_primitive_data_type.pl b/Task/Define_a_primitive_data_type/Perl/define_a_primitive_data_type.pl
new file mode 100644
index 0000000000..14f85f38de
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Perl/define_a_primitive_data_type.pl
@@ -0,0 +1,20 @@
+package One_To_Ten;
+use Carp qw(croak);
+use Tie::Scalar qw();
+use base qw(Tie::StdScalar);
+
+sub STORE {
+    my $self = shift;
+    my $val = int shift;
+    croak 'out of bounds' if $val < 1 or $val > 10;
+    $$self = $val;
+};
+
+package main;
+tie my $t, 'One_To_Ten';
+$t = 3;   # ok
+$t = 5.2; # ok, silently coerced to int
+$t = -2;  # dies, too small
+$t = 11;  # dies, too big
+$t = 'xyzzy';
+# dies, too small. string is 0 interpreted numerically
diff --git a/Task/Define_a_primitive_data_type/PicoLisp/define_a_primitive_data_type.l b/Task/Define_a_primitive_data_type/PicoLisp/define_a_primitive_data_type.l
new file mode 100644
index 0000000000..2a3653134d
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/PicoLisp/define_a_primitive_data_type.l
@@ -0,0 +1,32 @@
+(class +BoundedInt)
+# value lower upper
+
+(dm T (Low Up)
+   (=: lower (min Low Up))
+   (=: upper (max Low Up)) )
+
+(de "checkBounds" (Val)
+   (if (>= (: upper) Val (: lower))
+      Val
+      (throw 'boundedIntOutOfBounds
+         (pack
+            "value " Val
+            " is out of bounds [" (: lower) "," (: upper) "]" ) ) ) )
+
+(dm set> (Val)
+   (=: value ("checkBounds" Val)) )
+
+(dm +> (Val)
+   (=: value ("checkBounds" (+ Val (: value)))) )
+
+(dm val> ()
+   (: value) )
+
+(de main ()
+   (let (A (new '(+BoundedInt) 1 10)  B (new '(+BoundedInt) 1 10))
+      (set> A 6)
+      (when (catch 'boundedIntOutOfBounds (set> B 12) NIL)
+         (prinl @) )
+      (set> B 9)
+      (when (catch 'boundedIntOutOfBounds (+> A (val> B)) NIL)
+         (prinl @) ) ) )
diff --git a/Task/Define_a_primitive_data_type/Python/define_a_primitive_data_type.py b/Task/Define_a_primitive_data_type/Python/define_a_primitive_data_type.py
new file mode 100644
index 0000000000..44fbc5dd35
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Python/define_a_primitive_data_type.py
@@ -0,0 +1,22 @@
+>>> class num(int):
+    def __init__(self, b):
+        if 1 <= b <= 10:
+            return int.__init__(self+0)
+        else:
+            raise ValueError,"Value %s should be >=0 and <= 10" % b
+
+
+>>> x = num(3)
+>>> x = num(11)
+
+Traceback (most recent call last):
+  File "", line 1, in 
+    x = num(11)
+  File "", line 6, in __init__
+    raise ValueError,"Value %s should be >=0 and <= 10" % b
+ValueError: Value 11 should be >=0 and <= 10
+>>> x
+3
+>>> type(x)
+
+>>>
diff --git a/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type-2.rkt b/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type-2.rkt
new file mode 100644
index 0000000000..cd2356a264
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type-2.rkt
@@ -0,0 +1,11 @@
+#lang typed/racket
+
+(define-type 1UpTo10 (U 1 2 3 4 5 6 7 8 9 10))
+
+;; type-checks
+(: x 1UpTo10)
+(define x 3)
+
+;; does not type-check
+(: y 1UpTo10)
+(define y 18)
diff --git a/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type.rkt b/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type.rkt
new file mode 100644
index 0000000000..3e1bdca985
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Racket/define_a_primitive_data_type.rkt
@@ -0,0 +1,7 @@
+#lang racket
+
+(provide (contract-out [x 1-to-10/c]))
+
+(define 1-to-10/c (between/c 1 10))
+
+(define x 5)
diff --git a/Task/Define_a_primitive_data_type/Ruby/define_a_primitive_data_type.rb b/Task/Define_a_primitive_data_type/Ruby/define_a_primitive_data_type.rb
new file mode 100644
index 0000000000..775e8250dd
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Ruby/define_a_primitive_data_type.rb
@@ -0,0 +1,86 @@
+require 'test/unit'
+include Test::Unit::Assertions
+
+class MyInt
+  @@min = 1
+  @@max = 10
+
+  attr_reader :value
+  private :value
+
+  def initialize(val)
+    begin
+      v = Integer(val)
+    rescue ArgumentError
+      raise ArgumentError, "invalid value '#{val}', must be an integer"
+    end
+
+    unless v.between?(@@min, @@max)
+      raise ArgumentError, "invalid value '#{v}', must be between #{@@min} and #{@@max}"
+    end
+
+    @value = v
+  end
+
+  def method_missing(m, *args)
+    super unless @value.respond_to?(m)
+    myint_args = args.collect do |arg|
+      arg.kind_of?(self.class) ? arg.to_int : arg
+    end
+    result = @value.send(m, *myint_args)
+    return result if m == :coerce
+    case result
+    when Integer
+      MyInt.new(result)
+    when Array
+      result.collect do |element|
+        element.kind_of?(Integer) ? MyInt.new(element) : element
+      end
+    else
+      result
+    end
+  end
+
+  def respond_to?(method)
+    super or @value.respond_to? method
+  end
+
+  def to_int
+    @value
+  end
+  def to_f
+    Float(@value)
+  end
+  def to_s
+    @value.to_s
+  end
+  def inspect
+    to_s
+  end
+end
+
+
+assert_raise(ArgumentError) { MyInt.new("foo") }    # => invalid value 'foo', must be an integer
+assert_raise(ArgumentError) { MyInt.new(11) }       # => invalid value '11', must be an integer
+
+a = MyInt.new(7)
+b = MyInt.new(5)
+
+c = 5 + a
+assert_kind_of(Fixnum, c)
+assert_equal(12, c)
+
+c = a + 2
+assert_kind_of(MyInt, c)
+assert_equal(9, c.to_int)
+
+c = a + 2.8
+assert_kind_of(Float, c)
+assert_equal(9.8, c)
+
+c = a - b
+assert_kind_of(MyInt, c)
+assert_equal(2, c.to_int)
+
+assert_raise(ArgumentError) { c = a + b }    # => invalid value '12', must be an integer
+assert_raise(ArgumentError) { c = b - a }    # => invalid value '-2', must be an integer
diff --git a/Task/Define_a_primitive_data_type/Tcl/define_a_primitive_data_type.tcl b/Task/Define_a_primitive_data_type/Tcl/define_a_primitive_data_type.tcl
new file mode 100644
index 0000000000..f3b7abf2a5
--- /dev/null
+++ b/Task/Define_a_primitive_data_type/Tcl/define_a_primitive_data_type.tcl
@@ -0,0 +1,37 @@
+namespace eval ::myIntType {
+    variable value_cache
+    array set value_cache {}
+    variable type integer
+    variable min 1
+    variable max 10
+    variable errMsg "cannot set %s to %s: must be a $type between $min and $max"
+}
+proc ::myIntType::declare varname {
+    set ns [namespace current]
+    uplevel [list trace add variable $varname write ${ns}::write]
+    uplevel [list trace add variable $varname unset ${ns}::unset_var]
+}
+proc ::myIntType::unset_var {varname args} {
+    variable value_cache
+    unset value_cache($varname)
+}
+proc ::myIntType::validate {value} {
+    variable type
+    variable min
+    variable max
+    expr {[string is $type -strict $value] && $min <= $value && $value <= $max}
+}
+proc ::myIntType::write {varname args} {
+    variable value_cache
+    upvar $varname var
+    set value $var
+    if {[validate $value]} {
+        set value_cache($varname) $value
+    } else {
+        if {[info exists value_cache($varname)]} {
+            set var $value_cache($varname)
+        }
+        variable errMsg
+        error [format $errMsg $varname $value]
+    }
+}
diff --git a/Task/Delegates/0DESCRIPTION b/Task/Delegates/0DESCRIPTION
new file mode 100644
index 0000000000..06dfe5ca09
--- /dev/null
+++ b/Task/Delegates/0DESCRIPTION
@@ -0,0 +1,12 @@
+A delegate is a helper object used by another object. The delegator may send the delegate certain messages, and provide a default implementation when there is no delegate or the delegate does not respond to a message. This pattern is heavily used in [http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_3.html#//apple_ref/doc/uid/TP40002974-CH6-DontLinkElementID_93 Cocoa framework on Mac OS X]. See also [[wp:Delegation pattern]].
+
+Objects responsibilities:
+
+Delegator:
+* Keep an optional delegate instance.
+* Implement "operation" method, returning the delegate "thing" if the delegate respond to "thing", or the string "default implementation".
+
+Delegate:
+* Implement "thing" and return the string "delegate implementation"
+
+Show how objects are created and used. First, without a delegate, then with a delegate that does not implement "thing", and last with a delegate that implements "thing".
diff --git a/Task/Delegates/1META.yaml b/Task/Delegates/1META.yaml
new file mode 100644
index 0000000000..43afe9a8b6
--- /dev/null
+++ b/Task/Delegates/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Object oriented
diff --git a/Task/Delegates/C/delegates.c b/Task/Delegates/C/delegates.c
new file mode 100644
index 0000000000..14746eda89
--- /dev/null
+++ b/Task/Delegates/C/delegates.c
@@ -0,0 +1,86 @@
+#include 
+#include 
+#include 
+
+typedef const char * (*Responder)( int p1);
+
+typedef struct sDelegate {
+    Responder operation;
+} *Delegate;
+
+/* Delegate class constructor */
+Delegate NewDelegate( Responder rspndr )
+{
+    Delegate dl = malloc(sizeof(struct sDelegate));
+    dl->operation = rspndr;
+    return dl;
+}
+
+/* Thing method of Delegate */
+const char *DelegateThing(Delegate dl, int p1)
+{
+    return  (dl->operation)? (*dl->operation)(p1) : NULL;
+}
+
+/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+typedef struct sDelegator {
+    int     param;
+    char    *phrase;
+    Delegate delegate;
+} *Delegator;
+
+const char * defaultResponse( int p1)
+{
+    return "default implementation";
+}
+
+static struct sDelegate defaultDel = { &defaultResponse };
+
+/* Delegator class constructor */
+Delegator NewDelegator( int p, char *phrase)
+{
+    Delegator d  = malloc(sizeof(struct sDelegator));
+    d->param = p;
+    d->phrase = phrase;
+    d->delegate = &defaultDel;	/* default delegate */
+    return d;
+}
+
+/* Operation method of Delegator */
+const char *Delegator_Operation( Delegator theDelegator, int p1, Delegate delroy)
+{
+    const char *rtn;
+    if (delroy) {
+        rtn = DelegateThing(delroy, p1);
+        if (!rtn) {			/* delegate didn't handle 'thing' */
+            rtn = DelegateThing(theDelegator->delegate, p1);
+        }
+    }
+    else 		/* no delegate */
+        rtn = DelegateThing(theDelegator->delegate, p1);
+
+    printf("%s\n", theDelegator->phrase );
+    return rtn;
+}
+
+/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+const char *thing1( int p1)
+{
+    printf("We're in thing1 with value %d\n" , p1);
+    return "delegate implementation";
+}
+
+int main()
+{
+    Delegate del1 = NewDelegate(&thing1);
+    Delegate del2 = NewDelegate(NULL);
+    Delegator theDelegator = NewDelegator( 14, "A stellar vista, Baby.");
+
+    printf("Delegator returns %s\n\n",
+            Delegator_Operation( theDelegator, 3, NULL));
+    printf("Delegator returns %s\n\n",
+            Delegator_Operation( theDelegator, 3, del1));
+    printf("Delegator returns %s\n\n",
+            Delegator_Operation( theDelegator, 3, del2));
+    return 0;
+}
diff --git a/Task/Delegates/CoffeeScript/delegates-2.coffee b/Task/Delegates/CoffeeScript/delegates-2.coffee
new file mode 100644
index 0000000000..afbe9405ba
--- /dev/null
+++ b/Task/Delegates/CoffeeScript/delegates-2.coffee
@@ -0,0 +1,4 @@
+ > coffee foo.coffee
+default implementation
+default implementation
+Delegate Implementation
diff --git a/Task/Delegates/CoffeeScript/delegates.coffee b/Task/Delegates/CoffeeScript/delegates.coffee
new file mode 100644
index 0000000000..694a80fc4d
--- /dev/null
+++ b/Task/Delegates/CoffeeScript/delegates.coffee
@@ -0,0 +1,24 @@
+class Delegator
+  operation: ->
+    if @delegate and typeof (@delegate.thing) is "function"
+      return @delegate.thing()
+    "default implementation"
+
+class Delegate
+  thing: ->
+    "Delegate Implementation"
+
+testDelegator = ->
+  # Delegator with no delegate.
+  a = new Delegator()
+  console.log a.operation()
+
+  # Delegator with delegate not implementing "thing"
+  a.delegate = "A delegate may be any object"
+  console.log a.operation()
+
+  # Delegator with delegate that does implement "thing"
+  a.delegate = new Delegate()
+  console.log a.operation()
+
+testDelegator()
diff --git a/Task/Delegates/Go/delegates.go b/Task/Delegates/Go/delegates.go
new file mode 100644
index 0000000000..dd00c3a916
--- /dev/null
+++ b/Task/Delegates/Go/delegates.go
@@ -0,0 +1,39 @@
+package main
+import "fmt"
+
+type Delegator struct {
+    delegate interface{} // the delegate may be any type
+}
+
+// interface that represents anything that supports thing()
+type Thingable interface {
+    thing() string
+}
+
+func (self Delegator) operation() string {
+    if v, ok := self.delegate.(Thingable); ok {
+        return v.thing()
+    }
+    return "default implementation"
+}
+
+type Delegate int // any dummy type
+
+func (Delegate) thing() string {
+    return "delegate implementation"
+}
+
+func main() {
+    // Without a delegate:
+    a := Delegator{}
+    fmt.Println(a.operation()) // prints "default implementation"
+
+    // With a delegate that does not implement "thing"
+    a.delegate = "A delegate may be any object"
+    fmt.Println(a.operation()) // prints "default implementation"
+
+    // With a delegate:
+    var d Delegate
+    a.delegate = d
+    fmt.Println(a.operation()) // prints "delegate implementation"
+}
diff --git a/Task/Delegates/Java/delegates.java b/Task/Delegates/Java/delegates.java
new file mode 100644
index 0000000000..f2462dc899
--- /dev/null
+++ b/Task/Delegates/Java/delegates.java
@@ -0,0 +1,43 @@
+interface Thingable {
+    String thing();
+}
+
+class Delegator {
+    public Thingable delegate;
+
+    public String operation() {
+        if (delegate == null)
+            return "default implementation";
+        else
+            return delegate.thing();
+    }
+}
+
+class Delegate implements Thingable {
+    public String thing() {
+        return "delegate implementation";
+    }
+}
+
+// Example usage
+// Memory management ignored for simplification
+public class DelegateExample {
+    public static void main(String[] args) {
+        // Without a delegate:
+        Delegator a = new Delegator();
+        assert a.operation().equals("default implementation");
+
+        // With a delegate:
+        Delegate d = new Delegate();
+        a.delegate = d;
+        assert a.operation().equals("delegate implementation");
+
+        // Same as the above, but with an anonymous class:
+        a.delegate = new Thingable() {
+                public String thing() {
+                    return "anonymous delegate implementation";
+                }
+            };
+        assert a.operation().equals("anonymous delegate implementation");
+    }
+}
diff --git a/Task/Delegates/JavaScript/delegates.js b/Task/Delegates/JavaScript/delegates.js
new file mode 100644
index 0000000000..34c38f43d7
--- /dev/null
+++ b/Task/Delegates/JavaScript/delegates.js
@@ -0,0 +1,25 @@
+function Delegator() {
+  this.delegate = null ;
+  this.operation = function(){
+    if(this.delegate && typeof(this.delegate.thing) == 'function')
+      return this.delegate.thing() ;
+    return 'default implementation' ;
+  }
+}
+
+function Delegate() {
+  this.thing = function(){
+    return 'Delegate Implementation' ;
+  }
+}
+
+function testDelegator(){
+  var a = new Delegator() ;
+  document.write(a.operation() + "\n") ;
+
+  a.delegate = 'A delegate may be any object' ;
+  document.write(a.operation() + "\n") ;
+
+  a.delegate = new Delegate() ;
+  document.write(a.operation() + "\n") ;
+}
diff --git a/Task/Delegates/PHP/delegates.php b/Task/Delegates/PHP/delegates.php
new file mode 100644
index 0000000000..f3383b4a51
--- /dev/null
+++ b/Task/Delegates/PHP/delegates.php
@@ -0,0 +1,25 @@
+class Delegator {
+  function __construct() {
+    $this->delegate = NULL ;
+  }
+  function operation() {
+    if(method_exists($this->delegate, "thing"))
+      return $this->delegate->thing() ;
+    return 'default implementation' ;
+  }
+}
+
+class Delegate {
+  function thing() {
+    return 'Delegate Implementation' ;
+  }
+}
+
+$a = new Delegator() ;
+print "{$a->operation()}\n" ;
+
+$a->delegate = 'A delegate may be any object' ;
+print "{$a->operation()}\n" ;
+
+$a->delegate = new Delegate() ;
+print "{$a->operation()}\n" ;
diff --git a/Task/Delegates/Perl/delegates-2.pl b/Task/Delegates/Perl/delegates-2.pl
new file mode 100644
index 0000000000..fac70f3d04
--- /dev/null
+++ b/Task/Delegates/Perl/delegates-2.pl
@@ -0,0 +1,54 @@
+use 5.010_000;
+
+package Delegate::Protocol
+use Moose::Role;
+# All methods in the Protocol is optional
+#optional  'thing';
+# If we wanted to have a required method, we would state:
+# requires 'required_method';
+#
+
+package Delegate::NoThing;
+use Moose;
+with 'Delegate::Protocol';
+
+package Delegate;
+use Moose;
+
+#  The we confirm to Delegate::Protocol
+with 'Delegate::Protocol';
+sub thing { 'delegate implementation' };
+
+package Delegator;
+use Moose;
+
+has delegate => (
+     is      => 'rw',
+    does => 'Delegate::Protocol', # Moose insures that the delegate confirms to the protocol.
+   predicate => 'hasDelegate'
+);
+
+sub operation {
+
+    my ($self) = @_;
+    if( $self->hasDelegate  && $self->delegate->can('thing') ){
+        return $self->delegate->thing() . $postfix; # we are know that delegate has thing.
+    } else {
+        return 'default implementation';
+   }
+};
+
+package main;
+use strict;
+
+# No delegate
+my $delegator = Delegator->new();
+$delegator->operation eq 'default implementation' or die;
+
+# With a delegate that does not implement "thing"
+$delegator->delegate(  Delegate::NoThing->new );
+$delegator->operation eq 'default implementation' or die;
+
+# With delegate that implements "thing"
+$delegator->delegate(  Delegate->new );
+$delegator->operation eq 'delegate implementation' or die;
diff --git a/Task/Delegates/Perl/delegates.pl b/Task/Delegates/Perl/delegates.pl
new file mode 100644
index 0000000000..5a7aa68ccf
--- /dev/null
+++ b/Task/Delegates/Perl/delegates.pl
@@ -0,0 +1,38 @@
+use strict;
+
+package Delegator;
+sub new {
+   bless {}
+}
+sub operation {
+   my ($self) = @_;
+   if (defined $self->{delegate} && $self->{delegate}->can('thing')) {
+      $self->{delegate}->thing;
+   } else {
+      'default implementation';
+   }
+}
+1;
+
+package Delegate;
+sub new {
+   bless {};
+}
+sub thing {
+   'delegate implementation'
+}
+1;
+
+
+package main;
+# No delegate
+my $a = Delegator->new;
+$a->operation eq 'default implementation' or die;
+
+# With a delegate that does not implement "thing"
+$a->{delegate} = 'A delegate may be any object';
+$a->operation eq 'default implementation' or die;
+
+# With delegate that implements "thing"
+$a->{delegate} = Delegate->new;
+$a->operation eq 'delegate implementation' or die;
diff --git a/Task/Delegates/PicoLisp/delegates.l b/Task/Delegates/PicoLisp/delegates.l
new file mode 100644
index 0000000000..b344d90b9e
--- /dev/null
+++ b/Task/Delegates/PicoLisp/delegates.l
@@ -0,0 +1,30 @@
+(class +Delegator)
+# delegate
+
+(dm operation> ()
+   (if (: delegate)
+      (thing> @)
+      "default implementation" ) )
+
+
+(class +Delegate)
+# thing
+
+(dm T (Msg)
+   (=: thing Msg) )
+
+(dm thing> ()
+   (: thing) )
+
+
+(let A (new '(+Delegator))
+   # Without a delegate
+   (println (operation> A))
+
+   # With delegate that does not implement 'thing>'
+   (put A 'delegate (new '(+Delegate)))
+   (println (operation> A))
+
+   # With delegate that implements 'thing>'
+   (put A 'delegate (new '(+Delegate) "delegate implementation"))
+   (println (operation> A)) )
diff --git a/Task/Delegates/Python/delegates.py b/Task/Delegates/Python/delegates.py
new file mode 100644
index 0000000000..15febc3807
--- /dev/null
+++ b/Task/Delegates/Python/delegates.py
@@ -0,0 +1,25 @@
+class Delegator:
+   def __init__(self):
+      self.delegate = None
+   def operation(self):
+       if hasattr(self.delegate, 'thing') and callable(self.delegate.thing):
+          return self.delegate.thing()
+       return 'default implementation'
+
+class Delegate:
+   def thing(self):
+      return 'delegate implementation'
+
+if __name__ == '__main__':
+
+   # No delegate
+   a = Delegator()
+   assert a.operation() == 'default implementation'
+
+   # With a delegate that does not implement "thing"
+   a.delegate = 'A delegate may be any object'
+   assert a.operation() == 'default implementation'
+
+   # With delegate that implements "thing"
+   a.delegate = Delegate()
+   assert a.operation() == 'delegate implementation'
diff --git a/Task/Delegates/Ruby/delegates-2.rb b/Task/Delegates/Ruby/delegates-2.rb
new file mode 100644
index 0000000000..89531ad4fb
--- /dev/null
+++ b/Task/Delegates/Ruby/delegates-2.rb
@@ -0,0 +1,19 @@
+require 'forwardable'
+
+class Delegator; extend Forwardable
+  attr_accessor :delegate
+  def_delegator :@delegate, :thing, :delegated
+
+  def initialize
+    @delegate = Delegate.new()
+  end
+end
+
+class Delegate
+  def thing
+    'Delegate'
+  end
+end
+
+a = Delegator.new
+puts a.delegated # prints "Delegate"
diff --git a/Task/Delegates/Ruby/delegates.rb b/Task/Delegates/Ruby/delegates.rb
new file mode 100644
index 0000000000..b6e12b7b70
--- /dev/null
+++ b/Task/Delegates/Ruby/delegates.rb
@@ -0,0 +1,31 @@
+class Delegator
+   attr_accessor :delegate
+   def operation
+      if @delegate.respond_to?(:thing)
+         @delegate.thing
+      else
+         'default implementation'
+      end
+   end
+end
+
+class Delegate
+   def thing
+      'delegate implementation'
+   end
+end
+
+if __FILE__ == $PROGRAM_NAME
+
+   # No delegate
+   a = Delegator.new
+   puts a.operation # prints "default implementation"
+
+   # With a delegate that does not implement "thing"
+   a.delegate = 'A delegate may be any object'
+   puts a.operation # prints "default implementation"
+
+   # With delegate that implements "thing"
+   a.delegate = Delegate.new
+   puts a.operation # prints "delegate implementation"
+end
diff --git a/Task/Delegates/Tcl/delegates-2.tcl b/Task/Delegates/Tcl/delegates-2.tcl
new file mode 100644
index 0000000000..7a173f8000
--- /dev/null
+++ b/Task/Delegates/Tcl/delegates-2.tcl
@@ -0,0 +1,10 @@
+method operation {} {
+    if { [info exists delegate] &&
+         [info object isa object $delegate] &&
+         "thing" in [info object methods $delegate -all]
+    } then {
+        set result [$delegate thing]
+    } else {
+        set result "default implementation"
+    }
+}
diff --git a/Task/Delegates/Tcl/delegates.tcl b/Task/Delegates/Tcl/delegates.tcl
new file mode 100644
index 0000000000..0518a75c03
--- /dev/null
+++ b/Task/Delegates/Tcl/delegates.tcl
@@ -0,0 +1,53 @@
+package require TclOO
+
+oo::class create Delegate {
+    method thing {} {
+        return "delegate impl."
+    }
+    export thing
+}
+
+oo::class create Delegator {
+    variable delegate
+    constructor args {
+        my delegate {*}$args
+    }
+
+    method delegate args {
+        if {[llength $args] == 0} {
+            if {[info exists delegate]} {
+                return $delegate
+            }
+        } elseif {[llength $args] == 1} {
+            set delegate [lindex $args 0]
+        } else {
+            return -code error "wrong # args: should be \"[self] delegate ?target?\""
+        }
+    }
+
+    method operation {} {
+        try {
+            set result [$delegate thing]
+        } on error e {
+            set result "default implementation"
+        }
+        return $result
+    }
+}
+
+# to instantiate a named object, use: class create objname; objname aMethod
+# to have the class name the object:  set obj [class new]; $obj aMethod
+
+Delegator create a
+set b [Delegator new "not a delegate object"]
+set c [Delegator new [Delegate new]]
+
+assert {[a operation] eq "default implementation"}   ;# a "named" object, hence "a ..."
+assert {[$b operation] eq "default implementation"}  ;# an "anonymous" object, hence "$b ..."
+assert {[$c operation] ne "default implementation"}
+
+# now, set a delegate for object a
+a delegate [$c delegate]
+assert {[a operation] ne "default implementation"}
+
+puts "all assertions passed"
diff --git a/Task/Delete_a_file/0DESCRIPTION b/Task/Delete_a_file/0DESCRIPTION
new file mode 100644
index 0000000000..b9002b8537
--- /dev/null
+++ b/Task/Delete_a_file/0DESCRIPTION
@@ -0,0 +1 @@
+In this task, the job is to delete a file called "input.txt" and delete a directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.
diff --git a/Task/Delete_a_file/1META.yaml b/Task/Delete_a_file/1META.yaml
new file mode 100644
index 0000000000..40458d9f21
--- /dev/null
+++ b/Task/Delete_a_file/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: File System Operations
diff --git a/Task/Delete_a_file/AWK/delete_a_file.awk b/Task/Delete_a_file/AWK/delete_a_file.awk
new file mode 100644
index 0000000000..764f59ec15
--- /dev/null
+++ b/Task/Delete_a_file/AWK/delete_a_file.awk
@@ -0,0 +1,4 @@
+system("rm input.txt");
+system("rm /input.txt");
+system("rm -rf docs");
+system("rm -rf /docs");
diff --git a/Task/Delete_a_file/BASIC/delete_a_file-2.bas b/Task/Delete_a_file/BASIC/delete_a_file-2.bas
new file mode 100644
index 0000000000..0363d851a4
--- /dev/null
+++ b/Task/Delete_a_file/BASIC/delete_a_file-2.bas
@@ -0,0 +1 @@
+ERASE "m"; 1; "INPUTTXT"
diff --git a/Task/Delete_a_file/BASIC/delete_a_file.bas b/Task/Delete_a_file/BASIC/delete_a_file.bas
new file mode 100644
index 0000000000..3e0eaeddf6
--- /dev/null
+++ b/Task/Delete_a_file/BASIC/delete_a_file.bas
@@ -0,0 +1,4 @@
+KILL "INPUT.TXT"
+KILL "C:\INPUT.TXT"
+SHELL "RMDIR /S /Q DIR"
+SHELL "RMDIR /S /Q C:\DIR"
diff --git a/Task/Delete_a_file/C/delete_a_file-2.c b/Task/Delete_a_file/C/delete_a_file-2.c
new file mode 100644
index 0000000000..ba1ff9f996
--- /dev/null
+++ b/Task/Delete_a_file/C/delete_a_file-2.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  unlink("input.txt");
+  unlink("/input.txt");
+  rmdir("docs");
+  rmdir("/docs");
+  return 0;
+}
diff --git a/Task/Delete_a_file/C/delete_a_file.c b/Task/Delete_a_file/C/delete_a_file.c
new file mode 100644
index 0000000000..2246d3e0b3
--- /dev/null
+++ b/Task/Delete_a_file/C/delete_a_file.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  remove("input.txt");
+  remove("/input.txt");
+  remove("docs");
+  remove("/docs");
+  return 0;
+}
diff --git a/Task/Delete_a_file/Clojure/delete_a_file.clj b/Task/Delete_a_file/Clojure/delete_a_file.clj
new file mode 100644
index 0000000000..018025ed71
--- /dev/null
+++ b/Task/Delete_a_file/Clojure/delete_a_file.clj
@@ -0,0 +1,6 @@
+(import '(java.io File))
+(.delete (File. "output.txt"))
+(.delete (File. "docs"))
+
+(.delete (new File (str (File/separator) "output.txt")))
+(.delete (new File (str (File/separator) "docs")))
diff --git a/Task/Delete_a_file/Erlang/delete_a_file.erl b/Task/Delete_a_file/Erlang/delete_a_file.erl
new file mode 100644
index 0000000000..9c353eb0ec
--- /dev/null
+++ b/Task/Delete_a_file/Erlang/delete_a_file.erl
@@ -0,0 +1 @@
+file:delete("file.txt").
diff --git a/Task/Delete_a_file/Forth/delete_a_file.fth b/Task/Delete_a_file/Forth/delete_a_file.fth
new file mode 100644
index 0000000000..fcc6e3e53a
--- /dev/null
+++ b/Task/Delete_a_file/Forth/delete_a_file.fth
@@ -0,0 +1,2 @@
+ s" input.txt" delete-file throw
+s" /input.txt" delete-file throw
diff --git a/Task/Delete_a_file/Fortran/delete_a_file.f b/Task/Delete_a_file/Fortran/delete_a_file.f
new file mode 100644
index 0000000000..f47583cecd
--- /dev/null
+++ b/Task/Delete_a_file/Fortran/delete_a_file.f
@@ -0,0 +1,4 @@
+OPEN (UNIT=5, FILE="input.txt", STATUS="OLD")   ! Current directory
+CLOSE (UNIT=5, STATUS="DELETE")
+OPEN (UNIT=5, FILE="/input.txt", STATUS="OLD")  ! Root directory
+CLOSE (UNIT=5, STATUS="DELETE")
diff --git a/Task/Delete_a_file/Go/delete_a_file.go b/Task/Delete_a_file/Go/delete_a_file.go
new file mode 100644
index 0000000000..90ba93da95
--- /dev/null
+++ b/Task/Delete_a_file/Go/delete_a_file.go
@@ -0,0 +1,12 @@
+package main
+import "os"
+
+func main() {
+  os.Remove("input.txt")
+  os.Remove("/input.txt")
+  os.Remove("docs")
+  os.Remove("/docs")
+  // recursively removes contents:
+  os.RemoveAll("docs")
+  os.RemoveAll("/docs")
+}
diff --git a/Task/Delete_a_file/Haskell/delete_a_file.hs b/Task/Delete_a_file/Haskell/delete_a_file.hs
new file mode 100644
index 0000000000..acb38e335b
--- /dev/null
+++ b/Task/Delete_a_file/Haskell/delete_a_file.hs
@@ -0,0 +1,8 @@
+import System.IO
+import System.Directory
+
+main = do
+  removeFile "output.txt"
+  removeDirectory "docs"
+  removeFile "/output.txt"
+  removeDirectory "/docs"
diff --git a/Task/Delete_a_file/Java/delete_a_file.java b/Task/Delete_a_file/Java/delete_a_file.java
new file mode 100644
index 0000000000..35bbfea0ca
--- /dev/null
+++ b/Task/Delete_a_file/Java/delete_a_file.java
@@ -0,0 +1,18 @@
+import java.util.File;
+public class FileDeleteTest {
+   public static boolean deleteFile(String filename) {
+       boolean exists = new File(filename).delete();
+       return exists;
+   }
+   public static void test(String type, String filename) {
+       System.out.println("The following " + type + " called " + filename +
+           (deleteFile(filename) ? " was deleted." : " could not be deleted.")
+       );
+   }
+   public static void main(String args[]) {
+        test("file", "input.txt");
+        test("file", File.seperator + "input.txt");
+        test("directory", "docs");
+        test("directory", File.seperator + "docs" + File.seperator);
+   }
+}
diff --git a/Task/Delete_a_file/JavaScript/delete_a_file-2.js b/Task/Delete_a_file/JavaScript/delete_a_file-2.js
new file mode 100644
index 0000000000..05a80b0c84
--- /dev/null
+++ b/Task/Delete_a_file/JavaScript/delete_a_file-2.js
@@ -0,0 +1,10 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var f;
+f = fso.GetFile('input.txt');
+f.Delete();
+f = fso.GetFile('c:/input.txt');
+f.Delete();
+f = fso.GetFolder('docs');
+f.Delete();
+f = fso.GetFolder('c:/docs');
+f.Delete();
diff --git a/Task/Delete_a_file/JavaScript/delete_a_file.js b/Task/Delete_a_file/JavaScript/delete_a_file.js
new file mode 100644
index 0000000000..590ddd441a
--- /dev/null
+++ b/Task/Delete_a_file/JavaScript/delete_a_file.js
@@ -0,0 +1,7 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+
+fso.DeleteFile('input.txt');
+fso.DeleteFile('c:/input.txt');
+
+fso.DeleteFolder('docs');
+fso.DeleteFolder('c:/docs');
diff --git a/Task/Delete_a_file/Lua/delete_a_file.lua b/Task/Delete_a_file/Lua/delete_a_file.lua
new file mode 100644
index 0000000000..3545844427
--- /dev/null
+++ b/Task/Delete_a_file/Lua/delete_a_file.lua
@@ -0,0 +1,4 @@
+os.remove("input.txt")
+os.remove("/input.txt")
+os.remove("docs")
+os.remove("/docs")
diff --git a/Task/Delete_a_file/PHP/delete_a_file.php b/Task/Delete_a_file/PHP/delete_a_file.php
new file mode 100644
index 0000000000..e6c0ffa756
--- /dev/null
+++ b/Task/Delete_a_file/PHP/delete_a_file.php
@@ -0,0 +1,6 @@
+
diff --git a/Task/Delete_a_file/Perl/delete_a_file.pl b/Task/Delete_a_file/Perl/delete_a_file.pl
new file mode 100644
index 0000000000..223a405f1e
--- /dev/null
+++ b/Task/Delete_a_file/Perl/delete_a_file.pl
@@ -0,0 +1,7 @@
+use File::Spec::Functions qw(catfile rootdir);
+# here
+unlink 'input.txt';
+rmdir 'docs';
+# root dir
+unlink catfile rootdir, 'input.txt';
+rmdir catfile rootdir, 'docs';
diff --git a/Task/Delete_a_file/PicoLisp/delete_a_file.l b/Task/Delete_a_file/PicoLisp/delete_a_file.l
new file mode 100644
index 0000000000..a3c64534d7
--- /dev/null
+++ b/Task/Delete_a_file/PicoLisp/delete_a_file.l
@@ -0,0 +1,4 @@
+(call 'rm "input.txt")
+(call 'rmdir "docs")
+(call 'rm "/input.txt")
+(call 'rmdir "/docs")
diff --git a/Task/Delete_a_file/Python/delete_a_file-2.py b/Task/Delete_a_file/Python/delete_a_file-2.py
new file mode 100644
index 0000000000..4652f23ed6
--- /dev/null
+++ b/Task/Delete_a_file/Python/delete_a_file-2.py
@@ -0,0 +1,2 @@
+import shutil
+shutil.rmtree("docs")
diff --git a/Task/Delete_a_file/Python/delete_a_file.py b/Task/Delete_a_file/Python/delete_a_file.py
new file mode 100644
index 0000000000..8c6d870fab
--- /dev/null
+++ b/Task/Delete_a_file/Python/delete_a_file.py
@@ -0,0 +1,7 @@
+import os
+# current directory
+os.remove("output.txt")
+os.rmdir("docs")
+# root directory
+os.remove("/output.txt")
+os.rmdir("/docs")
diff --git a/Task/Delete_a_file/R/delete_a_file.r b/Task/Delete_a_file/R/delete_a_file.r
new file mode 100644
index 0000000000..b505cd3050
--- /dev/null
+++ b/Task/Delete_a_file/R/delete_a_file.r
@@ -0,0 +1,12 @@
+file.remove("input.txt")
+file.remove("/input.txt")
+
+# or
+file.remove("input.txt", "/input.txt")
+
+# or
+unlink("input.txt"); unlink("/input.txt")
+
+# directories needs the recursive flag
+unlink("docs", recursive = TRUE)
+unlink("/docs", recursive = TRUE)
diff --git a/Task/Delete_a_file/Ruby/delete_a_file.rb b/Task/Delete_a_file/Ruby/delete_a_file.rb
new file mode 100644
index 0000000000..4895cbe074
--- /dev/null
+++ b/Task/Delete_a_file/Ruby/delete_a_file.rb
@@ -0,0 +1,3 @@
+File.delete("output.txt", "/output.txt")
+Dir.delete("docs")
+Dir.delete("/docs")
diff --git a/Task/Delete_a_file/Scheme/delete_a_file.ss b/Task/Delete_a_file/Scheme/delete_a_file.ss
new file mode 100644
index 0000000000..004f1a97f2
--- /dev/null
+++ b/Task/Delete_a_file/Scheme/delete_a_file.ss
@@ -0,0 +1 @@
+(delete-file filename)
diff --git a/Task/Delete_a_file/Smalltalk/delete_a_file.st b/Task/Delete_a_file/Smalltalk/delete_a_file.st
new file mode 100644
index 0000000000..d86bfb01be
--- /dev/null
+++ b/Task/Delete_a_file/Smalltalk/delete_a_file.st
@@ -0,0 +1,4 @@
+File remove: 'input.txt'.
+File remove: 'docs'.
+File remove: '/input.txt'.
+File remove: '/docs'
diff --git a/Task/Delete_a_file/Tcl/delete_a_file.tcl b/Task/Delete_a_file/Tcl/delete_a_file.tcl
new file mode 100644
index 0000000000..f7bcb065a8
--- /dev/null
+++ b/Task/Delete_a_file/Tcl/delete_a_file.tcl
@@ -0,0 +1,7 @@
+file delete input.txt /input.txt
+
+# preserve directory if non-empty
+file delete docs /docs
+
+# delete even if non-empty
+file delete -force docs /docs
diff --git a/Task/Detect_division_by_zero/0DESCRIPTION b/Task/Detect_division_by_zero/0DESCRIPTION
new file mode 100644
index 0000000000..ee7afd59e8
--- /dev/null
+++ b/Task/Detect_division_by_zero/0DESCRIPTION
@@ -0,0 +1 @@
+Write a function to detect a divide by zero error without checking if the denominator is zero.
diff --git a/Task/Detect_division_by_zero/C/detect_division_by_zero.c b/Task/Detect_division_by_zero/C/detect_division_by_zero.c
new file mode 100644
index 0000000000..4bdb9c637e
--- /dev/null
+++ b/Task/Detect_division_by_zero/C/detect_division_by_zero.c
@@ -0,0 +1,100 @@
+#include 	/* INT_MIN */
+#include 	/* siglongjmp(), sigsetjmp() */
+#include 	/* perror(), printf() */
+#include 	/* exit() */
+#include 	/* sigaction(), sigemptyset() */
+
+static sigjmp_buf fpe_env;
+
+/*
+ * This SIGFPE handler jumps to fpe_env.
+ *
+ * A SIGFPE handler must not return, because the program might retry
+ * the division, which might cause an infinite loop. The only safe
+ * options are to _exit() the program or to siglongjmp() out.
+ */
+static void
+fpe_handler(int signal, siginfo_t *w, void *a)
+{
+	siglongjmp(fpe_env, w->si_code);
+	/* NOTREACHED */
+}
+
+/*
+ * Try to do x / y, but catch attempts to divide by zero.
+ */
+void
+try_division(int x, int y)
+{
+	struct sigaction act, old;
+	int code;
+	/*
+	 * The result must be volatile, else C compiler might delay
+	 * division until after sigaction() restores old handler.
+	 */
+	volatile int result;
+
+	/*
+	 * Save fpe_env so that fpe_handler() can jump back here.
+	 * sigsetjmp() returns zero.
+	 */
+	code = sigsetjmp(fpe_env, 1);
+	if (code == 0) {
+		/* Install fpe_handler() to trap SIGFPE. */
+		act.sa_sigaction = fpe_handler;
+		sigemptyset(&act.sa_mask);
+		act.sa_flags = SA_SIGINFO;
+		if (sigaction(SIGFPE, &act, &old) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		/* Do division. */
+		result = x / y;
+
+		/*
+		 * Restore old hander, so that SIGFPE cannot jump out
+		 * of a call to printf(), which might cause trouble.
+		 */
+		if (sigaction(SIGFPE, &old, NULL) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		printf("%d / %d is %d\n", x, y, result);
+	} else {
+		/*
+		 * We caught SIGFPE. Our fpe_handler() jumped to our
+		 * sigsetjmp() and passes a nonzero code.
+		 *
+		 * But first, restore old handler.
+		 */
+		if (sigaction(SIGFPE, &old, NULL) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		/* FPE_FLTDIV should never happen with integers. */
+		switch (code) {
+		case FPE_INTDIV: /* integer division by zero */
+		case FPE_FLTDIV: /* float division by zero */
+			printf("%d / %d: caught division by zero!\n", x, y);
+			break;
+		default:
+			printf("%d / %d: caught mysterious error!\n", x, y);
+			break;
+		}
+	}
+}
+
+/* Try some division. */
+int
+main()
+{
+	try_division(-44, 0);
+	try_division(-44, 5);
+	try_division(0, 5);
+	try_division(0, 0);
+	try_division(INT_MIN, -1);
+	return 0;
+}
diff --git a/Task/Detect_division_by_zero/Clojure/detect_division_by_zero.clj b/Task/Detect_division_by_zero/Clojure/detect_division_by_zero.clj
new file mode 100644
index 0000000000..3793dab44f
--- /dev/null
+++ b/Task/Detect_division_by_zero/Clojure/detect_division_by_zero.clj
@@ -0,0 +1,7 @@
+(defn safe-/ [x y]
+  (try (/ x y)
+    (catch ArithmeticException _
+      (println "Division by zero caught!")
+      (cond (> x 0)   Double/POSITIVE_INFINITY
+            (zero? x) Double/NaN
+            :else     Double/NEGATIVE_INFINITY) )))
diff --git a/Task/Detect_division_by_zero/Eiffel/detect_division_by_zero.e b/Task/Detect_division_by_zero/Eiffel/detect_division_by_zero.e
new file mode 100644
index 0000000000..3af5596524
--- /dev/null
+++ b/Task/Detect_division_by_zero/Eiffel/detect_division_by_zero.e
@@ -0,0 +1,21 @@
+class MAIN
+    creation main
+    feature main is
+        local
+            x, y: INTEGER;
+            retried: BOOLEAN;
+        do
+            x := 42;
+            y := 0;
+
+            if not retried then
+                io.put_real(x / y);
+            else
+                print("NaN%N");
+            end
+        rescue
+            print("Caught division by zero!%N");
+            retried := True;
+            retry
+        end
+end
diff --git a/Task/Detect_division_by_zero/Erlang/detect_division_by_zero.erl b/Task/Detect_division_by_zero/Erlang/detect_division_by_zero.erl
new file mode 100644
index 0000000000..d098c610e9
--- /dev/null
+++ b/Task/Detect_division_by_zero/Erlang/detect_division_by_zero.erl
@@ -0,0 +1,5 @@
+div_check(X,Y) ->
+    case catch X/Y of
+        {'EXIT',_} -> true;
+        _ -> false
+    end.
diff --git a/Task/Detect_division_by_zero/Forth/detect_division_by_zero.fth b/Task/Detect_division_by_zero/Forth/detect_division_by_zero.fth
new file mode 100644
index 0000000000..b64ed5e5bd
--- /dev/null
+++ b/Task/Detect_division_by_zero/Forth/detect_division_by_zero.fth
@@ -0,0 +1,2 @@
+: safe-/ ( x y -- x/y )
+  ['] / catch -55 = if cr ." divide by zero!" 2drop 0 then ;
diff --git a/Task/Detect_division_by_zero/Go/detect_division_by_zero.go b/Task/Detect_division_by_zero/Go/detect_division_by_zero.go
new file mode 100644
index 0000000000..64b98d5624
--- /dev/null
+++ b/Task/Detect_division_by_zero/Go/detect_division_by_zero.go
@@ -0,0 +1,16 @@
+package main
+
+import "fmt"
+
+func divCheck(x, y int) (q int, ok bool) {
+    defer func() {
+        recover()
+    }()
+    q = x / y
+    return q, true
+}
+
+func main() {
+    fmt.Println(divCheck(3, 2))
+    fmt.Println(divCheck(3, 0))
+}
diff --git a/Task/Detect_division_by_zero/Haskell/detect_division_by_zero.hs b/Task/Detect_division_by_zero/Haskell/detect_division_by_zero.hs
new file mode 100644
index 0000000000..ff59a9713e
--- /dev/null
+++ b/Task/Detect_division_by_zero/Haskell/detect_division_by_zero.hs
@@ -0,0 +1,3 @@
+import qualified Control.Exception as C
+check x y = C.catch (x `div` y `seq` return False)
+                    (\_ -> return True)
diff --git a/Task/Detect_division_by_zero/Java/detect_division_by_zero-2.java b/Task/Detect_division_by_zero/Java/detect_division_by_zero-2.java
new file mode 100644
index 0000000000..7d9196bd69
--- /dev/null
+++ b/Task/Detect_division_by_zero/Java/detect_division_by_zero-2.java
@@ -0,0 +1,6 @@
+public static boolean except(double numer, double denom){
+	try{
+		int dummy = (int)numer / (int)denom;//ArithmeticException is only thrown from integer math
+		return false;
+	}catch(ArithmeticException e){return true;}
+}
diff --git a/Task/Detect_division_by_zero/Java/detect_division_by_zero.java b/Task/Detect_division_by_zero/Java/detect_division_by_zero.java
new file mode 100644
index 0000000000..17c2920c4f
--- /dev/null
+++ b/Task/Detect_division_by_zero/Java/detect_division_by_zero.java
@@ -0,0 +1,3 @@
+public static boolean infinity(double numer, double denom){
+	return Double.isInfinite(numer/denom);
+}
diff --git a/Task/Detect_division_by_zero/JavaScript/detect_division_by_zero.js b/Task/Detect_division_by_zero/JavaScript/detect_division_by_zero.js
new file mode 100644
index 0000000000..b70c131f76
--- /dev/null
+++ b/Task/Detect_division_by_zero/JavaScript/detect_division_by_zero.js
@@ -0,0 +1,7 @@
+function divByZero(dividend,divisor)
+{
+	var quotient=dividend/divisor;
+        if(isNaN(quotient)) return 0; //Can be changed to whatever is desired by the programmer to be 0, false, or Infinity
+        return quotient; //Will return Infinity or -Infinity in cases of, for example, 5/0 or -7/0 respectively
+}
+alert(divByZero(0,0));
diff --git a/Task/Detect_division_by_zero/Lua/detect_division_by_zero.lua b/Task/Detect_division_by_zero/Lua/detect_division_by_zero.lua
new file mode 100644
index 0000000000..ac4efabda8
--- /dev/null
+++ b/Task/Detect_division_by_zero/Lua/detect_division_by_zero.lua
@@ -0,0 +1,5 @@
+function div(a,b)
+  quot = a/b
+  if quot == 1/0 then error() end
+  return quot
+end
diff --git a/Task/Detect_division_by_zero/PHP/detect_division_by_zero-2.php b/Task/Detect_division_by_zero/PHP/detect_division_by_zero-2.php
new file mode 100644
index 0000000000..e1e5d41a17
--- /dev/null
+++ b/Task/Detect_division_by_zero/PHP/detect_division_by_zero-2.php
@@ -0,0 +1,3 @@
+function div_check($x, $y) {
+  return @($x / $y) === FALSE; // works at least in PHP/5.2.6-3ubuntu4.5
+}
diff --git a/Task/Detect_division_by_zero/PHP/detect_division_by_zero.php b/Task/Detect_division_by_zero/PHP/detect_division_by_zero.php
new file mode 100644
index 0000000000..1a1180eb71
--- /dev/null
+++ b/Task/Detect_division_by_zero/PHP/detect_division_by_zero.php
@@ -0,0 +1,6 @@
+function div_check($x, $y) {
+  @trigger_error(''); // a dummy to detect when error didn't occur
+  @($x / $y);
+  $e = error_get_last();
+  return $e['message'] != '';
+}
diff --git a/Task/Detect_division_by_zero/Perl/detect_division_by_zero.pl b/Task/Detect_division_by_zero/Perl/detect_division_by_zero.pl
new file mode 100644
index 0000000000..eab12e9398
--- /dev/null
+++ b/Task/Detect_division_by_zero/Perl/detect_division_by_zero.pl
@@ -0,0 +1,4 @@
+sub div_check
+ {local $@;
+  eval {$_[0] / $_[1]};
+  $@ and $@ =~ /division by zero/;}
diff --git a/Task/Detect_division_by_zero/PicoLisp/detect_division_by_zero.l b/Task/Detect_division_by_zero/PicoLisp/detect_division_by_zero.l
new file mode 100644
index 0000000000..3d7bd14b6c
--- /dev/null
+++ b/Task/Detect_division_by_zero/PicoLisp/detect_division_by_zero.l
@@ -0,0 +1 @@
+(catch '("Div/0") (/ A B))
diff --git a/Task/Detect_division_by_zero/Python/detect_division_by_zero.py b/Task/Detect_division_by_zero/Python/detect_division_by_zero.py
new file mode 100644
index 0000000000..7680d5441c
--- /dev/null
+++ b/Task/Detect_division_by_zero/Python/detect_division_by_zero.py
@@ -0,0 +1,7 @@
+def div_check(x, y):
+  try:
+    x / y
+  except ZeroDivisionError:
+    return True
+  else:
+    return False
diff --git a/Task/Detect_division_by_zero/R/detect_division_by_zero.r b/Task/Detect_division_by_zero/R/detect_division_by_zero.r
new file mode 100644
index 0000000000..0d571e1a07
--- /dev/null
+++ b/Task/Detect_division_by_zero/R/detect_division_by_zero.r
@@ -0,0 +1,4 @@
+d <- 5/0
+if ( !is.finite(d) ) {
+  # it is Inf, -Inf, or NaN
+}
diff --git a/Task/Detect_division_by_zero/REXX/detect_division_by_zero.rexx b/Task/Detect_division_by_zero/REXX/detect_division_by_zero.rexx
new file mode 100644
index 0000000000..127aac0785
--- /dev/null
+++ b/Task/Detect_division_by_zero/REXX/detect_division_by_zero.rexx
@@ -0,0 +1,22 @@
+/*REXX program demonstrates  detects and handles  division by zero.     */
+
+signal on syntax                       /*handle all REXX syntax errors. */
+x = sourceline()                       /*being cute, x=size of this pgm.*/
+y = x-x                                /*setting to zero the obtuse way.*/
+z = x/y                                /*this'll do it, furrrr shurrre. */
+exit                                   /*We're kaput.   Ja vohl !       */
+
+/*───────────────────────────────error handling subroutines and others.─*/
+err: if rc==42 then do;  say;  say     /*1st, check for a specific error*/
+                    say center(' division by zero is a no-no. ',79,'═')
+                         say;  say
+                    exit 130
+                    end
+
+     say; say; say center(' error! ',max(40,linesize()%2),"*"); say
+               do j=1 for arg(); say arg(j); say; end; say;
+               exit 13
+
+novalue: syntax: call err 'REXX program' condition('C') "error",,
+             condition('D'),'REXX source statement (line' sigl"):",,
+             sourceline(sigl)
diff --git a/Task/Detect_division_by_zero/Racket/detect_division_by_zero.rkt b/Task/Detect_division_by_zero/Racket/detect_division_by_zero.rkt
new file mode 100644
index 0000000000..d657308a53
--- /dev/null
+++ b/Task/Detect_division_by_zero/Racket/detect_division_by_zero.rkt
@@ -0,0 +1,5 @@
+#lang racket
+
+(with-handlers ([exn:fail:contract:divide-by-zero?
+                 (λ (e) (displayln "Divided by zero"))])
+  (/ 1 0))
diff --git a/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-2.rb b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-2.rb
new file mode 100644
index 0000000000..f4de5fc780
--- /dev/null
+++ b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-2.rb
@@ -0,0 +1,4 @@
+irb(main):010:0> div_check(5, 0)
+=> true
+irb(main):011:0> div_check(5.0, 0)
+=> false
diff --git a/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-3.rb b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-3.rb
new file mode 100644
index 0000000000..e8a014aaf6
--- /dev/null
+++ b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-3.rb
@@ -0,0 +1,9 @@
+def div_check(x, y)
+  begin
+    x.div y
+  rescue ZeroDivisionError
+    true
+  else
+    false
+  end
+end
diff --git a/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-4.rb b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-4.rb
new file mode 100644
index 0000000000..cba4eb6100
--- /dev/null
+++ b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero-4.rb
@@ -0,0 +1,4 @@
+irb(main):010:0> div_check(5, 0)
+=> true
+irb(main):011:0> div_check(5.0, 0)
+=> true
diff --git a/Task/Detect_division_by_zero/Ruby/detect_division_by_zero.rb b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero.rb
new file mode 100644
index 0000000000..70da3f59ec
--- /dev/null
+++ b/Task/Detect_division_by_zero/Ruby/detect_division_by_zero.rb
@@ -0,0 +1,9 @@
+def div_check(x, y)
+  begin
+    x / y
+  rescue ZeroDivisionError
+    true
+  else
+    false
+  end
+end
diff --git a/Task/Detect_division_by_zero/Scala/detect_division_by_zero.scala b/Task/Detect_division_by_zero/Scala/detect_division_by_zero.scala
new file mode 100644
index 0000000000..de8f397df3
--- /dev/null
+++ b/Task/Detect_division_by_zero/Scala/detect_division_by_zero.scala
@@ -0,0 +1,17 @@
+object DivideByZero extends Application {
+
+  def check(x: Int, y: Int): Boolean = {
+    try {
+      val result = x / y
+      println(result)
+      return false
+    } catch {
+      case x: ArithmeticException => {
+        return true
+      }
+    }
+  }
+
+  println("divided by zero = " + check(1, 0))
+
+}
diff --git a/Task/Detect_division_by_zero/Smalltalk/detect_division_by_zero.st b/Task/Detect_division_by_zero/Smalltalk/detect_division_by_zero.st
new file mode 100644
index 0000000000..4fe01ba8d8
--- /dev/null
+++ b/Task/Detect_division_by_zero/Smalltalk/detect_division_by_zero.st
@@ -0,0 +1,7 @@
+zeroDivide := [:aBlock |
+	[aBlock value. false] on: ZeroDivide do: [true].
+	].
+
+"Testing"
+zeroDivide value: [2/1] "------> false"
+zeroDivide value: [2/0] "------> true"
diff --git a/Task/Detect_division_by_zero/Tcl/detect_division_by_zero-2.tcl b/Task/Detect_division_by_zero/Tcl/detect_division_by_zero-2.tcl
new file mode 100644
index 0000000000..d0fd532d2c
--- /dev/null
+++ b/Task/Detect_division_by_zero/Tcl/detect_division_by_zero-2.tcl
@@ -0,0 +1,15 @@
+proc div_check {x y} {
+    try {
+        puts "valid division: $x/$y=[expr {$x/$y}]"
+    } trap {ARITH DIVZERO} msg {
+        puts "caught division by zero: $x/$y -> $msg"
+    } trap {ARITH DOMAIN} msg {
+        puts "caught bad division: $x/$y -> $msg"
+    } on error msg {
+        puts "caught another error: $x/$y -> $msg"
+    }
+}
+
+foreach {num denom} {42 1  42 0  42.0 0.0  0 0  0.0 0.0  0 foo} {
+    div_check $num $denom
+}
diff --git a/Task/Detect_division_by_zero/Tcl/detect_division_by_zero.tcl b/Task/Detect_division_by_zero/Tcl/detect_division_by_zero.tcl
new file mode 100644
index 0000000000..81527c265e
--- /dev/null
+++ b/Task/Detect_division_by_zero/Tcl/detect_division_by_zero.tcl
@@ -0,0 +1,15 @@
+proc div_check {x y} {
+    if {[catch {expr {$x/$y}} result] == 0} {
+        puts "valid division: $x/$y=$result"
+    } else {
+        if {$result eq "divide by zero"} {
+            puts "caught division by zero: $x/$y -> $result"
+        } else {
+            puts "caught another error: $x/$y -> $result"
+        }
+    }
+}
+
+foreach denom {1 0 foo} {
+    div_check 42 $denom
+}
diff --git a/Task/Determine_if_a_string_is_numeric/0DESCRIPTION b/Task/Determine_if_a_string_is_numeric/0DESCRIPTION
new file mode 100644
index 0000000000..fd29441306
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/0DESCRIPTION
@@ -0,0 +1 @@
+Create a boolean function which takes in a string and tells whether it is a numeric string (floating point and negative numbers included) in the syntax the language uses for numeric literals or numbers converted from strings.
diff --git a/Task/Determine_if_a_string_is_numeric/1META.yaml b/Task/Determine_if_a_string_is_numeric/1META.yaml
new file mode 100644
index 0000000000..88eb5468ca
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Text processing
diff --git a/Task/Determine_if_a_string_is_numeric/AWK/determine_if_a_string_is_numeric.awk b/Task/Determine_if_a_string_is_numeric/AWK/determine_if_a_string_is_numeric.awk
new file mode 100644
index 0000000000..e275298c53
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/AWK/determine_if_a_string_is_numeric.awk
@@ -0,0 +1,2 @@
+$ awk 'function isnum(x){return(x==x+0)}BEGIN{print isnum("hello"),isnum("-42")}'
+0 1
diff --git a/Task/Determine_if_a_string_is_numeric/ActionScript/determine_if_a_string_is_numeric.as b/Task/Determine_if_a_string_is_numeric/ActionScript/determine_if_a_string_is_numeric.as
new file mode 100644
index 0000000000..427bc3d05c
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/ActionScript/determine_if_a_string_is_numeric.as
@@ -0,0 +1,4 @@
+public function isNumeric(num:String):Boolean
+{
+    return !isNaN(parseInt(num));
+}
diff --git a/Task/Determine_if_a_string_is_numeric/BASIC/determine_if_a_string_is_numeric.bas b/Task/Determine_if_a_string_is_numeric/BASIC/determine_if_a_string_is_numeric.bas
new file mode 100644
index 0000000000..1c863b1109
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/BASIC/determine_if_a_string_is_numeric.bas
@@ -0,0 +1,6 @@
+10 INPUT "Enter a string";S$:GOSUB 1000
+20 IF R THEN PRINT "Is num" ELSE PRINT"Not num"
+99 END
+1000 T1=VAL(S$):T1$=STR$(T1)
+1010 R=T1$=S$ OR T1$=" "+S$
+1099 RETURN
diff --git a/Task/Determine_if_a_string_is_numeric/C/determine_if_a_string_is_numeric.c b/Task/Determine_if_a_string_is_numeric/C/determine_if_a_string_is_numeric.c
new file mode 100644
index 0000000000..7ec0b8449a
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/C/determine_if_a_string_is_numeric.c
@@ -0,0 +1,10 @@
+#include 
+#include 
+int isNumeric (const char * s)
+{
+    if (s == NULL || *s == '\0' || isspace(*s))
+      return 0;
+    char * p;
+    strtod (s, &p);
+    return *p == '\0';
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric-2.clj b/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric-2.clj
new file mode 100644
index 0000000000..32bbc45dd2
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric-2.clj
@@ -0,0 +1 @@
+(numeric? [\1 \2 \3])  ;; yields logical true
diff --git a/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric.clj b/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric.clj
new file mode 100644
index 0000000000..0d85782e87
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Clojure/determine_if_a_string_is_numeric.clj
@@ -0,0 +1,7 @@
+(defn numeric? [s]
+  (if-let [s (seq s)]
+    (let [s (if (= (first s) \-) (next s) s)
+          s (drop-while #(Character/isDigit %) s)
+          s (if (= (first s) \.) (next s) s)
+          s (drop-while #(Character/isDigit %) s)]
+      (empty? s))))
diff --git a/Task/Determine_if_a_string_is_numeric/CoffeeScript/determine_if_a_string_is_numeric.coffee b/Task/Determine_if_a_string_is_numeric/CoffeeScript/determine_if_a_string_is_numeric.coffee
new file mode 100644
index 0000000000..0fce93feca
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/CoffeeScript/determine_if_a_string_is_numeric.coffee
@@ -0,0 +1,2 @@
+console.log (isFinite(s) for s in [5, "5", "-5", "5", "5e5", 0]) # all true
+console.log (isFinite(s) for s in [NaN, "fred", "###"]) # all false
diff --git a/Task/Determine_if_a_string_is_numeric/Erlang/determine_if_a_string_is_numeric.erl b/Task/Determine_if_a_string_is_numeric/Erlang/determine_if_a_string_is_numeric.erl
new file mode 100644
index 0000000000..df612e0d9a
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Erlang/determine_if_a_string_is_numeric.erl
@@ -0,0 +1,4 @@
+is_numeric(L) ->
+    Float = (catch erlang:list_to_float(L)),
+    Int = (catch erlang:list_to_integer(L)),
+    is_number(Float) orelse is_number(Int).
diff --git a/Task/Determine_if_a_string_is_numeric/Forth/determine_if_a_string_is_numeric.fth b/Task/Determine_if_a_string_is_numeric/Forth/determine_if_a_string_is_numeric.fth
new file mode 100644
index 0000000000..c01b4f31c1
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Forth/determine_if_a_string_is_numeric.fth
@@ -0,0 +1,22 @@
+: is-numeric ( addr len -- )
+  2dup snumber? ?dup if      \ not standard, but >number is more cumbersome to use
+   0< if
+     -rot type ."  as integer = " .
+   else
+     2swap type ."  as double = " <# #s #> type
+   then
+  else 2dup >float if
+    type ."  as float = " f.
+  else
+    type ."  isn't numeric in base " base @ dec.
+  then then ;
+
+s" 1234" is-numeric    \ 1234 as integer = 1234
+s" 1234." is-numeric    \ 1234. as double = 1234
+s" 1234e" is-numeric    \ 1234e as float = 1234.
+s" $1234" is-numeric    \ $1234 as integer = 4660  ( hex literal )
+s" %1010" is-numeric    \ %1010 as integer = 10  ( binary literal )
+s" beef" is-numeric    \ beef isn't numeric in base 10
+hex
+s" beef" is-numeric    \ beef as integer = BEEF
+s" &1234" is-numeric    \ &1234 as integer = 4D2 ( decimal literal )
diff --git a/Task/Determine_if_a_string_is_numeric/Fortran/determine_if_a_string_is_numeric.f b/Task/Determine_if_a_string_is_numeric/Fortran/determine_if_a_string_is_numeric.f
new file mode 100644
index 0000000000..a956a95df3
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Fortran/determine_if_a_string_is_numeric.f
@@ -0,0 +1,9 @@
+FUNCTION is_numeric(string)
+  IMPLICIT NONE
+  CHARACTER(len=*), INTENT(IN) :: string
+  LOGICAL :: is_numeric
+  REAL :: x
+  INTEGER :: e
+  READ(string,*,IOSTAT=e) x
+  is_numeric = e == 0
+END FUNCTION is_numeric
diff --git a/Task/Determine_if_a_string_is_numeric/Go/determine_if_a_string_is_numeric.go b/Task/Determine_if_a_string_is_numeric/Go/determine_if_a_string_is_numeric.go
new file mode 100644
index 0000000000..115429d82d
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Go/determine_if_a_string_is_numeric.go
@@ -0,0 +1,6 @@
+import "strconv"
+
+func IsNumeric(s string) bool {
+    _, err := strconv.ParseFloat(s, 64)
+    return err == nil
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric-2.hs b/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric-2.hs
new file mode 100644
index 0000000000..36d173667a
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric-2.hs
@@ -0,0 +1,4 @@
+areDigits = all isDigit
+isDigit  selects ASCII digits i.e. '0'..'9'
+isOctDigit selects '0'..'7'
+isHexDigit selects '0'..'9','A'..'F','a'..'f'
diff --git a/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric.hs b/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric.hs
new file mode 100644
index 0000000000..86ef1d224f
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Haskell/determine_if_a_string_is_numeric.hs
@@ -0,0 +1,10 @@
+isInteger s = case reads s :: [(Integer, String)] of
+  [(_, "")] -> True
+  _         -> False
+
+isDouble s = case reads s :: [(Double, String)] of
+  [(_, "")] -> True
+  _         -> False
+
+isNumeric :: String -> Bool
+isNumeric s = isInteger s || isDouble s
diff --git a/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-2.java b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-2.java
new file mode 100644
index 0000000000..2be40bb892
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-2.java
@@ -0,0 +1,10 @@
+private static final boolean isNumeric(final String s) {
+  if (s == null || s.isEmpty()) return false;
+  for (int x = 0; x < s.length(); x++) {
+    final char c = s.charAt(x);
+    if (x == 0 && (c == '-')) continue;  // negative
+    if ((c >= '0') && (c <= '9')) continue;  // 0 - 9
+    return false; // invalid
+  }
+  return true; // valid
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-3.java b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-3.java
new file mode 100644
index 0000000000..2ceacca357
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-3.java
@@ -0,0 +1,3 @@
+public static boolean isNumeric(String inputData) {
+  return inputData.matches("[-+]?\\d+(\\.\\d+)?");
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-4.java b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-4.java
new file mode 100644
index 0000000000..bb1b6ca838
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-4.java
@@ -0,0 +1,6 @@
+public static boolean isNumeric(String inputData) {
+  NumberFormat formatter = NumberFormat.getInstance();
+  ParsePosition pos = new ParsePosition(0);
+  formatter.parse(inputData, pos);
+  return inputData.length() == pos.getIndex();
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-5.java b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-5.java
new file mode 100644
index 0000000000..f8924ca9eb
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric-5.java
@@ -0,0 +1,4 @@
+public static boolean isNumeric(String inputData) {
+  Scanner sc = new Scanner(inputData);
+  return sc.hasNextInt();
+}
diff --git a/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric.java b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric.java
new file mode 100644
index 0000000000..f7c808b613
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Java/determine_if_a_string_is_numeric.java
@@ -0,0 +1,10 @@
+public boolean isNumeric(String input) {
+  try {
+    Integer.parseInt(input);
+    return true;
+  }
+  catch (NumberFormatException e) {
+    // s is not numeric
+    return false;
+  }
+}
diff --git a/Task/Determine_if_a_string_is_numeric/JavaScript/determine_if_a_string_is_numeric.js b/Task/Determine_if_a_string_is_numeric/JavaScript/determine_if_a_string_is_numeric.js
new file mode 100644
index 0000000000..599da9c56f
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/JavaScript/determine_if_a_string_is_numeric.js
@@ -0,0 +1,6 @@
+var value = "123.45e7"; // Assign string literal to value
+if (isFinite(value)) {
+  // value is a number
+}
+//Or, in web browser in address field:
+//  javascript:value="123.45e4"; if(isFinite(value)) {alert('numeric')} else {alert('non-numeric')}
diff --git a/Task/Determine_if_a_string_is_numeric/Lua/determine_if_a_string_is_numeric.lua b/Task/Determine_if_a_string_is_numeric/Lua/determine_if_a_string_is_numeric.lua
new file mode 100644
index 0000000000..1735b733c2
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Lua/determine_if_a_string_is_numeric.lua
@@ -0,0 +1,3 @@
+if tonumber(a) ~= nil then
+   --it's a number
+end;
diff --git a/Task/Determine_if_a_string_is_numeric/PHP/determine_if_a_string_is_numeric.php b/Task/Determine_if_a_string_is_numeric/PHP/determine_if_a_string_is_numeric.php
new file mode 100644
index 0000000000..c9028764ac
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/PHP/determine_if_a_string_is_numeric.php
@@ -0,0 +1,5 @@
+
diff --git a/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-2.pl b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-2.pl
new file mode 100644
index 0000000000..9b4d9a511e
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-2.pl
@@ -0,0 +1,8 @@
+if (/\D/)            { print "has nondigits\n" }
+if (/^\d+\z/)         { print "is a whole number\n" }
+if (/^-?\d+\z/)       { print "is an integer\n" }
+if (/^[+-]?\d+\z/)    { print "is a +/- integer\n" }
+if (/^-?\d+\.?\d*\z/) { print "is a real number\n" }
+if (/^-?(?:\d+(?:\.\d*)?&\.\d+)\z/) { print "is a decimal number\n" }
+if (/^([+-]?)(?=\d&\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?\z/)
+                     { print "a C float\n" }
diff --git a/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-3.pl b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-3.pl
new file mode 100644
index 0000000000..a68ed0186e
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric-3.pl
@@ -0,0 +1,15 @@
+sub getnum {
+    use POSIX;
+    my $str = shift;
+    $str =~ s/^\s+//;
+    $str =~ s/\s+$//;
+    $! = 0;
+    my($num, $unparsed) = strtod($str);
+    if (($str eq '') && ($unparsed != 0) && $!) {
+        return undef;
+    } else {
+        return $num;
+    }
+}
+
+sub is_numeric { defined getnum($_[0]) }
diff --git a/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric.pl b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric.pl
new file mode 100644
index 0000000000..efc2b13e9b
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Perl/determine_if_a_string_is_numeric.pl
@@ -0,0 +1,2 @@
+use Scalar::Util qw(looks_like_number);
+print looks_like_number($str) ? "numeric" : "not numeric\n";
diff --git a/Task/Determine_if_a_string_is_numeric/PicoLisp/determine_if_a_string_is_numeric.l b/Task/Determine_if_a_string_is_numeric/PicoLisp/determine_if_a_string_is_numeric.l
new file mode 100644
index 0000000000..46ad108cfe
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/PicoLisp/determine_if_a_string_is_numeric.l
@@ -0,0 +1,8 @@
+: (format "123")
+-> 123
+
+: (format "123a45")
+-> NIL
+
+: (format "-123.45" 4)
+-> 1234500
diff --git a/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-2.py b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-2.py
new file mode 100644
index 0000000000..b7d100d015
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-2.py
@@ -0,0 +1,3 @@
+s = '123'
+if s.isdigit():
+    # numeric
diff --git a/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-3.py b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-3.py
new file mode 100644
index 0000000000..ac9c8d2aa3
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-3.py
@@ -0,0 +1,28 @@
+def is_numeric(lit):
+    'Return value of numeric literal string or ValueError exception'
+
+    # Handle '0'
+    if lit == '0': return 0
+    # Hex/Binary
+    litneg = lit[1:] if lit[0] == '-' else lit
+    if litneg[0] == '0':
+        if litneg[1] in 'xX':
+            return int(lit,16)
+        elif litneg[1] in 'bB':
+            return int(lit,2)
+        else:
+            try:
+                return int(lit,8)
+            except ValueError:
+                pass
+
+    # Int/Float/Complex
+    try:
+        return int(lit)
+    except ValueError:
+        pass
+    try:
+        return float(lit)
+    except ValueError:
+        pass
+    return complex(lit)
diff --git a/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-4.py b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-4.py
new file mode 100644
index 0000000000..589d643611
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric-4.py
@@ -0,0 +1,16 @@
+>>> for s in ['0', '00', '123', '-123.', '-123e-4', '0123', '0x1a1', '-123+4.5j', '0b0101', '0.123', '-0xabc', '-0b101']:
+    print "%14s -> %-14s %s" % ('"'+s+'"', is_numeric(s), type(is_numeric(s)))
+
+           "0" -> 0              
+          "00" -> 0              
+         "123" -> 123            
+       "-123." -> -123.0         
+     "-123e-4" -> -0.0123        
+        "0123" -> 83             
+       "0x1a1" -> 417            
+   "-123+4.5j" -> (-123+4.5j)    
+      "0b0101" -> 5              
+       "0.123" -> 0.123          
+      "-0xabc" -> -2748          
+      "-0b101" -> -5             
+>>>
diff --git a/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric.py b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric.py
new file mode 100644
index 0000000000..66c76bcf88
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Python/determine_if_a_string_is_numeric.py
@@ -0,0 +1,5 @@
+s = '123'
+try:
+    i = float(s)
+except ValueError, TypeError:
+    print 'not numeric'
diff --git a/Task/Determine_if_a_string_is_numeric/R/determine_if_a_string_is_numeric.r b/Task/Determine_if_a_string_is_numeric/R/determine_if_a_string_is_numeric.r
new file mode 100644
index 0000000000..1ed5030650
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/R/determine_if_a_string_is_numeric.r
@@ -0,0 +1,3 @@
+> strings <- c("152", "-3.1415926", "Foo123")
+> suppressWarnings(!is.na(as.numeric(strings)))
+[1]  TRUE  TRUE FALSE
diff --git a/Task/Determine_if_a_string_is_numeric/REXX/determine_if_a_string_is_numeric.rexx b/Task/Determine_if_a_string_is_numeric/REXX/determine_if_a_string_is_numeric.rexx
new file mode 100644
index 0000000000..9792f9624e
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/REXX/determine_if_a_string_is_numeric.rexx
@@ -0,0 +1,46 @@
+/*REXX program to determine if a string is numeric. */
+yyy=' -123.78'               /*or some such.*/
+
+                             /*strings below are all numeric (REXX).*/
+zzz=' -123.78 '
+zzz='-123.78'
+zzz='2'
+zzz="2"
+zzz=2
+zzz='000000000004'
+zzz='+5'
+zzz=' +6 '
+zzz=' + 7 '
+zzz=' - 8 '
+zzz=' - .9'
+zzz='- 19.'
+zzz='.7'
+zzz='2e3'
+zzz=47e567
+zzz='2e-3'
+zzz='1.2e1'
+zzz=' .2E6'
+zzz=' 2.e5 '
+zzz='       +1.2E0002 '
+zzz='       +1.2e+002 '
+zzz=' +0000001.200e+002 '
+zzz=' - 000001.200e+002 '
+zzz=' - 000008.201e-00000000000000002 '
+
+/*Note:  some REXX interpreters allow use of tab chars as blanks.  */
+
+                             /*all statements below are equivalent.*/
+
+if \datatype(yyy,'n')       then say 'oops, not numeric:' yyy
+if \datatype(yyy,'N')       then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'N')       then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'numeric') then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'nimrod.') then say 'oops, not numeric:' yyy
+if  datatype(yyy)\=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)/=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)¬=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)¬= 'NUM'   then say 'oops, not numeric:' yyy
+
+/*note: REXX only looks at the first char for DATATYPE's  2nd arg. */
+
+/*note: some REXX interpreters don't support the ¬ (not) character.*/
diff --git a/Task/Determine_if_a_string_is_numeric/Racket/determine_if_a_string_is_numeric.rkt b/Task/Determine_if_a_string_is_numeric/Racket/determine_if_a_string_is_numeric.rkt
new file mode 100644
index 0000000000..1940c6d912
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Racket/determine_if_a_string_is_numeric.rkt
@@ -0,0 +1 @@
+(define (string-numeric? s) (number? (string->number s)))
diff --git a/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric-2.rb b/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric-2.rb
new file mode 100644
index 0000000000..b05066de1d
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric-2.rb
@@ -0,0 +1,3 @@
+def is_numeric?(s)
+    !!Float(s) rescue false
+end
diff --git a/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric.rb b/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric.rb
new file mode 100644
index 0000000000..d9681f1b6e
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Ruby/determine_if_a_string_is_numeric.rb
@@ -0,0 +1,9 @@
+def is_numeric?(s)
+  begin
+    Float(s)
+  rescue
+    false # not numeric
+  else
+    true # numeric
+  end
+end
diff --git a/Task/Determine_if_a_string_is_numeric/Scala/determine_if_a_string_is_numeric.scala b/Task/Determine_if_a_string_is_numeric/Scala/determine_if_a_string_is_numeric.scala
new file mode 100644
index 0000000000..a32c095f6e
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Scala/determine_if_a_string_is_numeric.scala
@@ -0,0 +1 @@
+def isNumeric(input: String): Boolean = input.forall(_.isDigit)
diff --git a/Task/Determine_if_a_string_is_numeric/Scheme/determine_if_a_string_is_numeric.ss b/Task/Determine_if_a_string_is_numeric/Scheme/determine_if_a_string_is_numeric.ss
new file mode 100644
index 0000000000..025008579f
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Scheme/determine_if_a_string_is_numeric.ss
@@ -0,0 +1 @@
+(define (numeric? s) (string->number s))
diff --git a/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-2.st b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-2.st
new file mode 100644
index 0000000000..13baef25c6
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-2.st
@@ -0,0 +1 @@
+(Number readFrom:(aString readStream) onError:[nil]) notNil
diff --git a/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-3.st b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-3.st
new file mode 100644
index 0000000000..5341c38c2b
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric-3.st
@@ -0,0 +1 @@
+(Scanner scanNumberFrom:(aString readStream)) notNil
diff --git a/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric.st b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric.st
new file mode 100644
index 0000000000..bf875f30cc
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Smalltalk/determine_if_a_string_is_numeric.st
@@ -0,0 +1,20 @@
+String extend [
+  realIsNumeric [
+     (self first = $+) |
+     (self first = $-)
+        ifTrue: [
+           ^ (self allButFirst) isNumeric
+        ]
+        ifFalse: [
+           ^ self isNumeric
+        ]
+  ]
+]
+
+{ '1234'.            "true"
+  '3.14'. '+3.8111'. "true"
+  '+45'.             "true"
+  '-3.78'.           "true"
+  '-3.78.23'. "false"
+  '123e3'     "false: the notation is not recognized"
+} do: [ :a | a realIsNumeric printNl ]
diff --git a/Task/Determine_if_a_string_is_numeric/Tcl/determine_if_a_string_is_numeric.tcl b/Task/Determine_if_a_string_is_numeric/Tcl/determine_if_a_string_is_numeric.tcl
new file mode 100644
index 0000000000..7963affc2c
--- /dev/null
+++ b/Task/Determine_if_a_string_is_numeric/Tcl/determine_if_a_string_is_numeric.tcl
@@ -0,0 +1,3 @@
+if {
+    [string is double -strict $varname]
+} then {  ... }
diff --git a/Task/Forest_fire/0DESCRIPTION b/Task/Forest_fire/0DESCRIPTION
new file mode 100644
index 0000000000..5386b19475
--- /dev/null
+++ b/Task/Forest_fire/0DESCRIPTION
@@ -0,0 +1,17 @@
+{{wikipedia|Forest-fire model}}[[Category:Cellular automata]]
+Implement the Drossel and Schwabl definition of the [[wp:Forest-fire model|forest-fire model]].
+
+It is basically a 2D [[wp:Cellular automaton|cellular automaton]] where each cell can be in three distinct states (''empty'', ''tree'' and ''burning'') and evolves according to the following rules (as given by Wikipedia)
+
+# A burning cell turns into an empty cell
+# A tree will burn if at least one neighbor is burning
+# A tree ignites with probability ''f'' even if no neighbor is burning
+# An empty space fills with a tree with probability ''p''
+
+Neighborhood is the [[wp:Moore neighborhood|Moore neighborhood]]; boundary conditions are so that on the boundary the cells are always empty ("fixed" boundary condition).
+
+At the beginning, populate the lattice with empty and tree cells according to a specific probability (e.g. a cell has the probability 0.5 to be a tree). Then, let the system evolve.
+
+Task's requirements do not include graphical display or the ability to change parameters (probabilities ''p'' and ''f'') through a graphical or command line interface.
+
+'''See also''' [[Conway's Game of Life]] and [[Wireworld]].
diff --git a/Task/Forest_fire/1META.yaml b/Task/Forest_fire/1META.yaml
new file mode 100644
index 0000000000..a2413d963b
--- /dev/null
+++ b/Task/Forest_fire/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Games
diff --git a/Task/Forest_fire/C/forest_fire-2.c b/Task/Forest_fire/C/forest_fire-2.c
new file mode 100644
index 0000000000..6b9879b441
--- /dev/null
+++ b/Task/Forest_fire/C/forest_fire-2.c
@@ -0,0 +1,65 @@
+#include 
+#include 
+#include 
+
+enum { empty = 0, tree = 1, fire = 2 };
+const char *disp[] = {"  ", "\033[32m/\\\033[m", "\033[07;31m/\\\033[m"};
+double tree_prob = 0.01, burn_prob = 0.0001;
+
+#define for_x for (int x = 0; x < w; x++)
+#define for_y for (int y = 0; y < h; y++)
+#define for_yx for_y for_x
+#define chance(x) (rand() < RAND_MAX * x)
+void evolve(int w, int h)
+{
+	unsigned univ[h][w], new[h][w];
+	for_yx new[y][x] = univ[y][x] = chance(tree_prob) ? tree : empty;
+
+show:	printf("\033[H");
+	for_y {
+		for_x printf(disp[univ[y][x]]);
+		printf("\033[E");
+	}
+	fflush(stdout);
+
+	for_yx {
+		switch (univ[y][x]) {
+		case fire:	new[y][x] = empty;
+				break;
+		case empty:	if (chance(tree_prob)) new[y][x] = tree;
+				break;
+		default:
+			for (int y1 = y - 1; y1 <= y + 1; y1++) {
+				if (y1 < 0 || y1 >= h) continue;
+				for (int x1 = x - 1; x1 <= x + 1; x1++) {
+					if (x1 < 0 || x1 >= w) continue;
+					if (univ[y1][x1] != fire) continue;
+
+					new[y][x] = fire;
+					goto burn;
+				}
+			}
+
+			burn:
+			if (new[y][x] == tree && chance(burn_prob))
+				new[y][x] = fire;
+		}
+	}
+
+	for_yx { univ[y][x] = new[y][x]; }
+	//usleep(100000);
+	goto show;
+}
+
+int main(int c, char **v)
+{
+	//srand(time(0));
+	int w = 0, h = 0;
+
+	if (c > 1) w = atoi(v[1]);
+	if (c > 2) h = atoi(v[2]);
+	if (w <= 0) w = 30;
+	if (h <= 0) h = 30;
+
+	evolve(w, h);
+}
diff --git a/Task/Forest_fire/C/forest_fire.c b/Task/Forest_fire/C/forest_fire.c
new file mode 100644
index 0000000000..7ae68f1dc5
--- /dev/null
+++ b/Task/Forest_fire/C/forest_fire.c
@@ -0,0 +1,248 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+// defaults
+#define PROB_TREE 0.55
+#define PROB_F 0.00001
+#define PROB_P 0.001
+
+#define TIMERFREQ 100
+
+#ifndef WIDTH
+#  define WIDTH 640
+#endif
+#ifndef HEIGHT
+#  define HEIGHT 480
+#endif
+#ifndef BPP
+#  define BPP 32
+#endif
+
+#if BPP != 32
+  #warning This program could not work with BPP different from 32
+#endif
+
+uint8_t *field[2], swapu;
+double prob_f = PROB_F, prob_p = PROB_P, prob_tree = PROB_TREE;
+
+enum cell_state {
+  VOID, TREE, BURNING
+};
+
+// simplistic random func to give [0, 1)
+double prand()
+{
+  return (double)rand() / (RAND_MAX + 1.0);
+}
+
+// initialize the field
+void init_field(void)
+{
+  int i, j;
+  swapu = 0;
+  for(i = 0; i < WIDTH; i++)
+  {
+    for(j = 0; j < HEIGHT; j++)
+    {
+      *(field[0] + j*WIDTH + i) = prand() > prob_tree ? VOID : TREE;
+    }
+  }
+}
+
+// the "core" of the task: the "forest-fire CA"
+bool burning_neighbor(int, int);
+pthread_mutex_t synclock = PTHREAD_MUTEX_INITIALIZER;
+static uint32_t simulate(uint32_t iv, void *p)
+{
+  int i, j;
+
+  /*
+    Since this is called by SDL, "likely"(*) in a separated
+    thread, we try to avoid corrupted updating of the display
+    (done by the show() func): show needs the "right" swapu
+    i.e. the right complete field. (*) what if it is not so?
+    The following is an attempt to avoid unpleasant updates.
+   */
+  pthread_mutex_lock(&synclock);
+
+  for(i = 0; i < WIDTH; i++) {
+    for(j = 0; j < HEIGHT; j++) {
+      enum cell_state s = *(field[swapu] + j*WIDTH + i);
+      switch(s)
+      {
+      case BURNING:
+	*(field[swapu^1] + j*WIDTH + i) = VOID;
+	break;
+      case VOID:
+	*(field[swapu^1] + j*WIDTH + i) = prand() > prob_p ? VOID : TREE;
+	break;
+      case TREE:
+	if (burning_neighbor(i, j))
+	  *(field[swapu^1] + j*WIDTH + i) = BURNING;
+	else
+	  *(field[swapu^1] + j*WIDTH + i) = prand() > prob_f ? TREE : BURNING;
+	break;
+      default:
+	fprintf(stderr, "corrupted field\n");
+	break;
+      }
+    }
+  }
+  swapu ^= 1;
+  pthread_mutex_unlock(&synclock);
+  return iv;
+}
+
+// the field is a "part" of an infinite "void" region
+#define NB(I,J) (((I)=0)&&((J)=0) \
+		 ? (*(field[swapu] + (J)*WIDTH + (I)) == BURNING) : false)
+bool burning_neighbor(int i, int j)
+{
+  return NB(i-1,j-1) || NB(i-1, j) || NB(i-1, j+1) ||
+    NB(i, j-1) || NB(i, j+1) ||
+    NB(i+1, j-1) || NB(i+1, j) || NB(i+1, j+1);
+}
+
+
+// "map" the field into gfx mem
+// burning trees are red
+// trees are green
+// "voids" are black;
+void show(SDL_Surface *s)
+{
+  int i, j;
+  uint8_t *pixels = (uint8_t *)s->pixels;
+  uint32_t color;
+  SDL_PixelFormat *f = s->format;
+
+  pthread_mutex_lock(&synclock);
+  for(i = 0; i < WIDTH; i++) {
+    for(j = 0; j < HEIGHT; j++) {
+      switch(*(field[swapu] + j*WIDTH + i)) {
+      case VOID:
+	color = SDL_MapRGBA(f, 0,0,0,255);
+	break;
+      case TREE:
+	color = SDL_MapRGBA(f, 0,255,0,255);
+	break;
+      case BURNING:
+	color = SDL_MapRGBA(f, 255,0,0,255);
+	break;
+      }
+      *(uint32_t*)(pixels + j*s->pitch + i*(BPP>>3)) = color;
+    }
+  }
+  pthread_mutex_unlock(&synclock);
+}
+
+int main(int argc, char **argv)
+{
+  SDL_Surface *scr = NULL;
+  SDL_Event event[1];
+  bool quit = false, running = false;
+  SDL_TimerID tid;
+
+  // add variability to the simulation
+  srand(time(NULL));
+
+  // we can change prob_f and prob_p
+  // prob_f prob of spontaneous ignition
+  // prob_p prob of birth of a tree
+  double *p;
+  for(argv++, argc--; argc > 0; argc--, argv++)
+  {
+    if ( strcmp(*argv, "prob_f") == 0 && argc > 1 )
+    {
+      p = &prob_f;
+    } else if ( strcmp(*argv, "prob_p") == 0 && argc > 1 ) {
+      p = &prob_p;
+    } else if ( strcmp(*argv, "prob_tree") == 0 && argc > 1 ) {
+      p = &prob_tree;
+    } else  continue;
+
+
+    argv++; argc--;
+    char *s = NULL;
+    double t = strtod(*argv, &s);
+    if (s != *argv) *p = t;
+  }
+
+  printf("prob_f %lf\nprob_p %lf\nratio %lf\nprob_tree %lf\n",
+	 prob_f, prob_p, prob_p/prob_f,
+	 prob_tree);
+
+  if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0 ) return EXIT_FAILURE;
+  atexit(SDL_Quit);
+
+  field[0] = malloc(WIDTH*HEIGHT);
+  if (field[0] == NULL) exit(EXIT_FAILURE);
+  field[1] = malloc(WIDTH*HEIGHT);
+  if (field[1] == NULL) { free(field[0]); exit(EXIT_FAILURE); }
+
+  scr = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE|SDL_DOUBLEBUF);
+  if (scr == NULL) {
+    fprintf(stderr, "SDL_SetVideoMode: %s\n", SDL_GetError());
+    free(field[0]); free(field[1]);
+    exit(EXIT_FAILURE);
+  }
+
+  init_field();
+
+  tid = SDL_AddTimer(TIMERFREQ, simulate, NULL); // suppose success
+  running = true;
+
+  event->type = SDL_VIDEOEXPOSE;
+  SDL_PushEvent(event);
+
+  while(SDL_WaitEvent(event) && !quit)
+  {
+    switch(event->type)
+    {
+    case SDL_VIDEOEXPOSE:
+      while(SDL_LockSurface(scr) != 0) SDL_Delay(1);
+      show(scr);
+      SDL_UnlockSurface(scr);
+      SDL_Flip(scr);
+      event->type = SDL_VIDEOEXPOSE;
+      SDL_PushEvent(event);
+      break;
+    case SDL_KEYDOWN:
+      switch(event->key.keysym.sym)
+      {
+      case SDLK_q:
+	quit = true;
+	break;
+      case SDLK_p:
+	if (running)
+	{
+	  running = false;
+	  pthread_mutex_lock(&synclock);
+	  SDL_RemoveTimer(tid); // ignore failure...
+	  pthread_mutex_unlock(&synclock);
+	} else {
+	  running = true;
+	  tid = SDL_AddTimer(TIMERFREQ, simulate, NULL);
+	  // suppose success...
+	}
+	break;
+      }
+    case SDL_QUIT:
+      quit = true;
+      break;
+    }
+  }
+
+  if (running) {
+    pthread_mutex_lock(&synclock);
+    SDL_RemoveTimer(tid);
+    pthread_mutex_unlock(&synclock);
+  }
+  free(field[0]); free(field[1]);
+  exit(EXIT_SUCCESS);
+}
diff --git a/Task/Forest_fire/Clojure/forest_fire.clj b/Task/Forest_fire/Clojure/forest_fire.clj
new file mode 100644
index 0000000000..3889ba9b15
--- /dev/null
+++ b/Task/Forest_fire/Clojure/forest_fire.clj
@@ -0,0 +1,77 @@
+(def burn-prob 0.1)
+(def new-tree-prob 0.5)
+
+(defn grow-new-tree? [] (> new-tree-prob (rand)))
+(defn burn-tree? [] (> burn-prob (rand)))
+(defn tree-maker [] (if (grow-new-tree?) :tree :grass))
+
+(defn make-forest
+  ([] (make-forest 5))
+  ([size]
+  (take size (repeatedly #(take size (repeatedly tree-maker))))))
+
+(defn tree-at [forest row col] (try (-> forest
+                                   (nth row)
+                                   (nth col))
+                                    (catch Exception _ false)))
+
+(defn neighbores-burning? [forest row col]
+  (letfn [(burnt? [row col] (= :burnt (tree-at forest row col)))]
+    (or
+     (burnt? (inc row) col)
+     (burnt? (dec row) col)
+     (burnt? row (inc col))
+     (burnt? row (dec col)))))
+
+(defn lightning-strike [forest]
+  (map (fn [forest-row]
+         (map #(if (and (= % :tree) (burn-tree?))
+                 :fire!
+                 %)
+              forest-row)
+         )
+       forest))
+
+(defn burn-out-trees [forest]
+  (map (fn [forest-row]
+         (map #(case %
+              :burnt :grass
+              :fire! :burnt
+              %)
+              forest-row))
+       forest))
+
+(defn burn-neighbores [forest]
+  (let [forest-size (count forest)
+        indicies (partition forest-size (for [row (range forest-size) col (range forest-size)] (cons row (list col))))]
+    (map (fn [forest-row indicies-row]
+           (map #(if (and
+                       (= :tree %)
+                       (neighbores-burning? forest (first %2) (second %2)))
+                    :fire!
+                    %)
+                forest-row indicies-row))
+         forest indicies)))
+
+(defn grow-new-trees [forest] (map (fn [forest-row]
+                                     (map #(if (= % :grass)
+                                             (tree-maker)
+                                             %)
+                                          forest-row))
+                                     forest))
+
+(defn forest-fire
+  ([] (forest-fire 5))
+  ([forest-size]
+  (loop
+      [forest (make-forest forest-size)]
+    (pprint forest)
+    (Thread/sleep 300)
+    (-> forest
+        (burn-out-trees)
+        (lightning-strike)
+        (burn-neighbores)
+        (grow-new-trees)
+        (recur)))))
+
+(forest-fire)
diff --git a/Task/Forest_fire/Fortran/forest_fire-2.f b/Task/Forest_fire/Fortran/forest_fire-2.f
new file mode 100644
index 0000000000..0e516235b9
--- /dev/null
+++ b/Task/Forest_fire/Fortran/forest_fire-2.f
@@ -0,0 +1,18 @@
+program ForestFireTest
+  use ForestFireModel
+  implicit none
+
+  type(forestfire) :: f
+  integer :: i
+
+  f = forestfire_new(74, 40)
+
+  do i = 1, 1001
+     write(*,'(A)', advance='no') achar(z'1b') // '[H' // achar(z'1b') // '[2J'
+     call forestfire_print(f)
+     call forestfire_evolve(f)
+  end do
+
+  call forestfire_destroy(f)
+
+end program ForestFireTest
diff --git a/Task/Forest_fire/Fortran/forest_fire.f b/Task/Forest_fire/Fortran/forest_fire.f
new file mode 100644
index 0000000000..d2c26326c7
--- /dev/null
+++ b/Task/Forest_fire/Fortran/forest_fire.f
@@ -0,0 +1,183 @@
+module ForestFireModel
+  implicit none
+
+  type :: forestfire
+     integer, dimension(:,:,:), allocatable :: field
+     integer :: width, height
+     integer :: swapu
+     real :: prob_tree, prob_f, prob_p
+  end type forestfire
+
+  integer, parameter :: &
+       empty = 0, &
+       tree = 1, &
+       burning = 2
+
+  private :: bcheck, set, oget, burning_neighbor ! cset, get
+
+contains
+
+  ! create and initialize the field(s)
+  function forestfire_new(w, h, pt, pf, pp) result(res)
+    type(forestfire) :: res
+    integer, intent(in) :: w, h
+    real, intent(in), optional :: pt, pf, pp
+
+    integer :: i, j
+    real :: r
+
+    allocate(res%field(2,w,h)) ! no error check
+    res%prob_tree = 0.5
+    res%prob_f = 0.00001
+    res%prob_p = 0.001
+    if ( present(pt) ) res%prob_tree = pt
+    if ( present(pf) ) res%prob_f = pf
+    if ( present(pp) ) res%prob_p = pp
+
+    res%width = w
+    res%height = h
+    res%swapu = 0
+
+    res%field = empty
+
+    do i = 1,w
+       do j = 1,h
+          call random_number(r)
+          if ( r <= res%prob_tree ) call cset(res, i, j, tree)
+       end do
+    end do
+
+  end function forestfire_new
+
+  ! destroy the field(s)
+  subroutine forestfire_destroy(f)
+    type(forestfire), intent(inout) :: f
+
+    if ( allocated(f%field) ) deallocate(f%field)
+
+  end subroutine forestfire_destroy
+
+  ! evolution
+  subroutine forestfire_evolve(f)
+    type(forestfire), intent(inout) :: f
+
+    integer :: i, j
+    real :: r
+
+    do i = 1, f%width
+       do j = 1, f%height
+          select case ( get(f, i, j) )
+          case (burning)
+             call set(f, i, j, empty)
+          case (empty)
+             call random_number(r)
+             if ( r > f%prob_p ) then
+                call set(f, i, j, empty)
+             else
+                call set(f, i, j, tree)
+             end if
+          case (tree)
+             if ( burning_neighbor(f, i, j) ) then
+                call set(f, i, j, burning)
+             else
+                call random_number(r)
+                if ( r > f%prob_f ) then
+                   call set(f, i, j, tree)
+                else
+                   call set(f, i, j, burning)
+                end if
+             end if
+          end select
+       end do
+    end do
+    f%swapu = ieor(f%swapu, 1)
+  end subroutine forestfire_evolve
+
+  ! helper funcs/subs
+  subroutine set(f, i, j, t)
+    type(forestfire), intent(inout) :: f
+    integer, intent(in) :: i, j, t
+
+    if ( bcheck(f, i, j) ) then
+       f%field(ieor(f%swapu,1), i, j) = t
+    end if
+  end subroutine set
+
+  subroutine cset(f, i, j, t)
+    type(forestfire), intent(inout) :: f
+    integer, intent(in) :: i, j, t
+
+    if ( bcheck(f, i, j) ) then
+       f%field(f%swapu, i, j) = t
+    end if
+  end subroutine cset
+
+  function bcheck(f, i, j)
+    logical :: bcheck
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    bcheck = .false.
+    if ( (i >= 1) .and. (i <= f%width) .and. &
+         (j >= 1) .and. (j <= f%height) ) bcheck = .true.
+
+  end function bcheck
+
+
+  function get(f, i, j) result(r)
+    integer :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    if ( .not. bcheck(f, i, j) ) then
+       r = empty
+    else
+       r = f%field(f%swapu, i, j)
+    end if
+  end function get
+
+  function oget(f, i, j) result(r)
+    integer :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    if ( .not. bcheck(f, i, j) ) then
+       r = empty
+    else
+       r = f%field(ieor(f%swapu,1), i, j)
+    end if
+  end function oget
+
+  function burning_neighbor(f, i, j) result(r)
+    logical :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    integer, dimension(3,3) :: s
+
+    s = f%field(f%swapu, i-1:i+1, j-1:j+1)
+    s(2,2) = empty
+    r = any(s == burning)
+  end function burning_neighbor
+
+  subroutine forestfire_print(f)
+    type(forestfire), intent(in) :: f
+
+    integer :: i, j
+
+    do j = 1, f%height
+       do i = 1, f%width
+          select case(get(f, i, j))
+          case (empty)
+             write(*,'(A)', advance='no') '.'
+          case (tree)
+             write(*,'(A)', advance='no') 'Y'
+          case (burning)
+             write(*,'(A)', advance='no') '*'
+          end select
+       end do
+       write(*,*)
+    end do
+  end subroutine forestfire_print
+
+end module ForestFireModel
diff --git a/Task/Forest_fire/Go/forest_fire.go b/Task/Forest_fire/Go/forest_fire.go
new file mode 100644
index 0000000000..2da80ab1d3
--- /dev/null
+++ b/Task/Forest_fire/Go/forest_fire.go
@@ -0,0 +1,84 @@
+package main
+
+import (
+    "fmt"
+    "math/rand"
+    "strings"
+)
+
+const (
+    rows = 20
+    cols = 30
+    p    = .01
+    f    = .001
+)
+
+const rx = rows + 2
+const cx = cols + 2
+
+func main() {
+    odd := make([]byte, rx*cx)
+    even := make([]byte, rx*cx)
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            if rand.Intn(2) == 1 {
+                odd[r*cx+c] = 'T'
+            }
+        }
+    }
+    for {
+        print(odd)
+        step(even, odd)
+        fmt.Scanln()
+
+        print(even)
+        step(odd, even)
+        fmt.Scanln()
+    }
+}
+
+func print(model []byte) {
+    fmt.Println(strings.Repeat("__", cols))
+    fmt.Println()
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            if model[r*cx+c] == 0 {
+                fmt.Print("  ")
+            } else {
+                fmt.Printf(" %c", model[r*cx+c])
+            }
+        }
+        fmt.Println()
+    }
+}
+
+func step(dst, src []byte) {
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            x := r*cx + c
+            dst[x] = src[x]
+            switch dst[x] {
+            case '#':
+                // rule 1. A burning cell turns into an empty cell
+                dst[x] = 0
+            case 'T':
+                // rule 2. A tree will burn if at least one neighbor is burning
+                if src[x-cx-1]=='#'  || src[x-cx]=='#' || src[x-cx+1]=='#' ||
+                    src[x-1] == '#'  ||                   src[x+1] == '#'  ||
+                    src[x+cx-1]=='#' || src[x+cx]=='#' || src[x+cx+1] == '#' {
+                    dst[x] = '#'
+
+                    // rule 3. A tree ignites with probability f
+                    // even if no neighbor is burning
+                } else if rand.Float64() < f {
+                    dst[x] = '#'
+                }
+            default:
+                // rule 4. An empty space fills with a tree with probability p
+                if rand.Float64() < p {
+                    dst[x] = 'T'
+                }
+            }
+        }
+    }
+}
diff --git a/Task/Forest_fire/Haskell/forest_fire-2.hs b/Task/Forest_fire/Haskell/forest_fire-2.hs
new file mode 100644
index 0000000000..2feca4a1c6
--- /dev/null
+++ b/Task/Forest_fire/Haskell/forest_fire-2.hs
@@ -0,0 +1,25 @@
+*Main> evolveForest 6 50 3
+
+>>>>>> 1:
+     T T    T TTTTTTTTT TT   TT T  T   T TT  TT
+ TTT  TT T TT TTTT T   T  TT T T T  T T T  TTTTT T
+ T  TT T TTT T  TTTTT TTTTTTTT      T TTT  TTTT TT
+   TT TT T TT T TTT T T T TTTT T TTT   TT  T    TT
+ TT  TT  TT  TT T T  T T   TT   T   T TT T T TTTTT
+ T  TT T     T T  TTTTTT T T T  T T TT       T  TT
+
+>>>>>> 2:
+     T T    T TTTTTTTTT TT   TT TT T   $ TT  TT
+ TTT  TT T TT TTTT T   T  TT T T T  T T T  TTTTT T
+ TT TTTT TT$ T TTTTTT TTTTT$TT      T T$T  TTTT TT
+   TT TT T TT T TTTTTTT T TTTT T TTT   TT  T    TT
+ TT  TT  TT  TT T T  T T   TT   T   T TT T T TTTTT
+TTT TT TT    T T  TTTTTT T T T  T T TT       TT TT
+
+>>>>>> 3:
+    TTTTT   T TTTTTTTTT TT   TT TT T     TT  TT
+ TTTT TT T $$ TTTT T   T  $$ T T T  T $ $  TTTTT T
+ TTTTTTT T$  T TTTTTT TTTT$ $T      T $ $ TTTTT TT
+   TT TT T $$ T TTTTTTT T $$$T T TTT   $$  T T TTT
+ TT  TT  TT TTT T T TT TT  TT   T   T TT T T TTTTT
+TTT TT TT T  T T  TTTTTT T T T  T T TT       TT TT
diff --git a/Task/Forest_fire/Haskell/forest_fire.hs b/Task/Forest_fire/Haskell/forest_fire.hs
new file mode 100644
index 0000000000..af60384e6b
--- /dev/null
+++ b/Task/Forest_fire/Haskell/forest_fire.hs
@@ -0,0 +1,47 @@
+import Data.List
+import Control.Arrow
+import Control.Monad
+import System.Random
+
+data Cell = Empty | Tree | Fire deriving (Eq)
+
+instance Show Cell where
+  show Empty   = " "
+  show Tree    = "T"
+  show Fire    = "$"
+
+randomCell = liftM ([Empty, Tree] !!) (randomRIO (0,1) :: IO Int)
+randomChance = randomRIO (0,1.0) :: IO Double
+
+rim b = map (fb b). (fb =<< rb) where
+    fb = liftM2 (.) (:) (flip (++) . return)
+    rb = fst. unzip. zip (repeat b). head
+
+take3x3 = concatMap (transpose. map take3). take3 where
+ take3 = init. init. takeWhile (not.null). map(take 3). tails
+
+list2Mat n = takeWhile(not.null). map(take n). iterate(drop n)
+
+evolveForest :: Int -> Int -> Int -> IO ()
+evolveForest m n k = do
+  let s = m*n
+  fs <- replicateM s randomCell
+
+  let nextState xs = do
+        ts <- replicateM s randomChance
+        vs <- replicateM s randomChance
+        let rv [r1,[l,c,r],r3] newTree fire
+              | c == Fire                                      = Empty
+              | c == Tree && Fire `elem` concat [r1,[l,r],r3]  = Fire
+              | c == Tree && 0.01 >= fire                      = Fire
+              | c == Empty && 0.1 >= newTree                   = Tree
+              | otherwise                                      = c
+        return $ zipWith3 rv xs ts vs
+
+      evolve i xs = unless (i > k) $
+        do  let nfs = nextState $ take3x3 $ rim Empty $ list2Mat n xs
+            putStrLn ("\n>>>>>> " ++ show i ++ ":")
+            mapM_ (putStrLn. concatMap show) $ list2Mat n xs
+            nfs >>= evolve (i+1)
+
+  evolve 1 fs
diff --git a/Task/Forest_fire/Java/forest_fire.java b/Task/Forest_fire/Java/forest_fire.java
new file mode 100644
index 0000000000..a35a4cae15
--- /dev/null
+++ b/Task/Forest_fire/Java/forest_fire.java
@@ -0,0 +1,137 @@
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class Fire {
+	private static final char BURNING = 'w'; //w looks like fire, right?
+	private static final char TREE = 'T';
+	private static final char EMPTY = '.';
+	private static final double F = 0.2;
+	private static final double P = 0.4;
+	private static final double TREE_PROB = 0.5;
+	
+	private static List process(List land){
+		List newLand = new LinkedList();
+		for(int i = 0; i < land.size(); i++){
+			String rowAbove, thisRow = land.get(i), rowBelow;
+			if(i == 0){//first row
+				rowAbove = null;
+				rowBelow = land.get(i + 1);
+			}else if(i == land.size() - 1){//last row
+				rowBelow = null;
+				rowAbove = land.get(i - 1);
+			}else{//middle
+				rowBelow = land.get(i + 1);
+				rowAbove = land.get(i - 1);
+			}
+			newLand.add(processRows(rowAbove, thisRow, rowBelow));
+		}
+		return newLand;
+	}
+
+	private static String processRows(String rowAbove, String thisRow,
+			String rowBelow){
+		String newRow = "";
+		for(int i = 0; i < thisRow.length();i++){
+			switch(thisRow.charAt(i)){
+			case BURNING:
+				newRow+= EMPTY;
+				break;
+			case EMPTY:
+				newRow+= Math.random() < P ? TREE : EMPTY;
+				break;
+			case TREE:
+				String neighbors = "";
+				if(i == 0){//first char
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i, i + 2);
+					neighbors+= thisRow.charAt(i + 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i, i + 2);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}else if(i == thisRow.length() - 1){//last char
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i - 1, i + 1);
+					neighbors+= thisRow.charAt(i - 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i - 1, i + 1);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}else{//middle
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i - 1, i + 2);
+					neighbors+= thisRow.charAt(i + 1);
+					neighbors+= thisRow.charAt(i - 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i - 1, i + 2);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}
+				newRow+= Math.random() < F ? BURNING : TREE;
+			}
+		}
+		return newRow;
+	}
+	
+	public static List populate(int width, int height){
+		List land = new LinkedList();
+		for(;height > 0; height--){//height is just a copy anyway
+			StringBuilder line = new StringBuilder(width);
+			for(int i = width; i > 0; i--){
+				line.append((Math.random() < TREE_PROB) ? TREE : EMPTY);
+			}
+			land.add(line.toString());
+		}
+		return land;
+	}
+	
+	//process the land n times
+	public static void processN(List land, int n){
+		for(int i = 0;i < n; i++){
+			land = process(land);
+		}
+	}
+	
+	//process the land n times and print each step along the way
+	public static void processNPrint(List land, int n){
+		for(int i = 0;i < n; i++){
+			land = process(land);
+			print(land);
+		}
+	}
+	
+	//print the land
+	public static void print(List land){
+		for(String row: land){
+			System.out.println(row);
+		}
+		System.out.println();
+	}
+	
+	public static void main(String[] args){
+		List land = Arrays.asList(".TTT.T.T.TTTT.T",
+				"T.T.T.TT..T.T..",
+				"TT.TTTT...T.TT.",
+				"TTT..TTTTT.T..T",
+				".T.TTT....TT.TT",
+				"...T..TTT.TT.T.",
+				".TT.TT...TT..TT",
+				".TT.T.T..T.T.T.",
+				"..TTT.TT.T..T..",
+				".T....T.....TTT",
+				"T..TTT..T..T...",
+				"TTT....TTTTTT.T",
+				"......TwTTT...T",
+				"..T....TTTTTTTT",
+				".T.T.T....TT...");
+		print(land);
+		processNPrint(land, 10);
+		
+		System.out.println("Random land test:");
+		
+		land = populate(10, 10);
+		print(land);
+		processNPrint(land, 10);
+	}
+}
diff --git a/Task/Forest_fire/JavaScript/forest_fire-2.js b/Task/Forest_fire/JavaScript/forest_fire-2.js
new file mode 100644
index 0000000000..b1f085cfec
--- /dev/null
+++ b/Task/Forest_fire/JavaScript/forest_fire-2.js
@@ -0,0 +1,14 @@
+
+
+
+Forest Fire
+
+
+
+Your browser doesn't support HTML5 Canvas.
+
+
+
+
diff --git a/Task/Forest_fire/JavaScript/forest_fire.js b/Task/Forest_fire/JavaScript/forest_fire.js
new file mode 100644
index 0000000000..2c93d6cca7
--- /dev/null
+++ b/Task/Forest_fire/JavaScript/forest_fire.js
@@ -0,0 +1,63 @@
+var forest = {
+    X: 50,
+    Y: 50,
+    propTree: 0.5,
+    propTree2: 0.01,
+    propBurn: 0.0001,
+    t: [],
+    c: ['rgb(255,255,255)', 'rgb(0,255,0)', 'rgb(255,0,0)']
+};
+
+for(var i = 0; i < forest.Y; i++) {
+    forest.t[i] = [];
+    for(var j = 0; j < forest.Y; j++) {
+        forest.t[i][j] = Math.random() < forest.propTree ? 1 : 0;
+    }
+}
+
+function afterLoad(forest) {
+    var canvas = document.getElementById('canvas');
+    var c = canvas.getContext('2d');
+    for(var i = 0; i < forest.X; i++) {
+        for(var j = 0; j < forest.Y; j++) {
+            c.fillStyle = forest.c[forest.t[i][j]];
+            c.fillRect(10*j, 10*i, 10*j+9, 10*i+9);
+        }
+    }
+}
+
+function doStep(forest) {
+    var to = [];
+    for(var i = 0; i < forest.Y; i++) {
+        to[i] = forest.t[i].slice(0);
+    }
+
+    //indices outside the array are undefined; which converts to 0=empty on forced typecast
+    for(var i = 0; i < forest.Y; i++) {
+        for(var j = 0; j < forest.Y; j++) {
+            if(0 == to[i][j]) {
+                forest.t[i][j] = Math.random() < forest.propTree2 ? 1 : 0;
+            } else if(1 == to[i][j]) {
+                if(
+                    ((i>0) && (2 == to[i-1][j])) ||
+                    ((i0) && (2 == to[i][j-1])) ||
+                    ((j[0] + $i;
+				next if $y < 0 || $y >= $h;
+				my $x = $_->[1] + $j;
+				next if $x < 0 || $x >= $w;
+				if ($forest[$y][$x] == 2) {
+					$new[$i][$j] = 2;
+					last;
+				}
+			}
+		} elsif (rand() < $tree_prob) {
+			$new[$i][$j] = 1;
+		} elsif ($forest[$i][$j] == 3) {
+			$new[$i][$j] = 0;
+		}
+	}}
+	@forest = @new;
+}
+
+sub forest {
+	print $r;
+	for (@forest) {
+		for (@$_) {
+			when(0) { print " "; }
+			when(1) { print "${green}*"}
+			when(2) { print "${red}&" }
+			when(3) { print "${yellow}&" }
+		}
+		print "\033[E\033[1G";
+	}
+	iterate;
+}
+
+forest while (1);
diff --git a/Task/Forest_fire/PicoLisp/forest_fire.l b/Task/Forest_fire/PicoLisp/forest_fire.l
new file mode 100644
index 0000000000..fe8638cda6
--- /dev/null
+++ b/Task/Forest_fire/PicoLisp/forest_fire.l
@@ -0,0 +1,43 @@
+(load "@lib/simul.l")
+
+(scl 3)
+
+(de forestFire (Dim ProbT ProbP ProbF)
+   (let Grid (grid Dim Dim)
+      (for Col Grid
+         (for This Col
+            (=: tree (> ProbT (rand 0 1.0))) ) )
+      (loop
+         (disp Grid NIL
+            '((This)
+               (cond
+                  ((: burn) "# ")
+                  ((: tree) "T ")
+                  (T ". ") ) ) )
+         (wait 1000)
+         (for Col Grid
+            (for This Col
+               (=: next
+                  (cond
+                     ((: burn) NIL)
+                     ((: tree)
+                        (if
+                           (or
+                              (find  # Neighbor burning?
+                                 '((Dir) (get (Dir This) 'burn))
+                                 (quote
+                                    west east south north
+                                    ((X) (south (west X)))
+                                    ((X) (north (west X)))
+                                    ((X) (south (east X)))
+                                    ((X) (north (east X))) ) )
+                              (> ProbF (rand 0 1.0)) )
+                           'burn
+                           'tree ) )
+                     (T (and (> ProbP (rand 0 1.0)) 'tree)) ) ) ) )
+         (for Col Grid
+            (for This Col
+               (if (: next)
+                  (put This @ T)
+                  (=: burn)
+                  (=: tree) ) ) ) ) ) )
diff --git a/Task/Forest_fire/Python/forest_fire.py b/Task/Forest_fire/Python/forest_fire.py
new file mode 100644
index 0000000000..de04e58f96
--- /dev/null
+++ b/Task/Forest_fire/Python/forest_fire.py
@@ -0,0 +1,83 @@
+'''
+Forest-Fire Cellular automation
+ See: http://en.wikipedia.org/wiki/Forest-fire_model
+'''
+
+L = 15
+# d = 2 # Fixed
+initial_trees = 0.55
+p = 0.01
+f = 0.001
+
+try:
+    raw_input
+except:
+    raw_input = input
+
+import random
+
+
+tree, burning, space = 'TB.'
+hood = ((-1,-1), (-1,0), (-1,1),
+        (0,-1),          (0, 1),
+        (1,-1),  (1,0),  (1,1))
+
+def initialise():
+    grid = {(x,y): (tree if random.random()<= initial_trees else space)
+            for x in range(L)
+            for y in range(L) }
+    return grid
+
+def gprint(grid):
+    txt = '\n'.join(''.join(grid[(x,y)] for x in range(L))
+                    for y in range(L))
+    print(txt)
+
+def quickprint(grid):
+    t = b = 0
+    ll = L * L
+    for x in range(L):
+        for y in range(L):
+            if grid[(x,y)] in (tree, burning):
+                t += 1
+                if grid[(x,y)] == burning:
+                    b += 1
+    print(('Of %6i cells, %6i are trees of which %6i are currently burning.'
+          + ' (%6.3f%%, %6.3f%%)')
+          % (ll, t, b, 100. * t / ll, 100. * b / ll))
+
+
+def gnew(grid):
+    newgrid = {}
+    for x in range(L):
+        for y in range(L):
+            if grid[(x,y)] == burning:
+                newgrid[(x,y)] = space
+            elif grid[(x,y)] == space:
+                newgrid[(x,y)] = tree if random.random()<= p else space
+            elif grid[(x,y)] == tree:
+                newgrid[(x,y)] = (burning
+                                   if any(grid.get((x+dx,y+dy),space) == burning
+                                            for dx,dy in hood)
+                                        or random.random()<= f
+                                   else tree)
+    return newgrid
+
+if __name__ == '__main__':
+    grid = initialise()
+    iter = 0
+    while True:
+        quickprint(grid)
+        inp = raw_input('Print/Quit// %6i: ' % iter).lower().strip()
+        if inp:
+            if inp[0] == 'p':
+                gprint(grid)
+            elif inp.isdigit():
+                for i in range(int(inp)):
+                    iter +=1
+                    grid = gnew(grid)
+                    quickprint(grid)
+            elif inp[0] == 'q':
+                break
+        grid = gnew(grid)
+        iter +=1
diff --git a/Task/Forest_fire/REXX/forest_fire.rexx b/Task/Forest_fire/REXX/forest_fire.rexx
new file mode 100644
index 0000000000..206106347b
--- /dev/null
+++ b/Task/Forest_fire/REXX/forest_fire.rexx
@@ -0,0 +1,67 @@
+/*REXX program grows and displays a forest  (with growth and lightning).
+   ┌───────────────────────────elided version─────────────────────────┐
+   ├─── full version has many more options and enhanced displays. ────┤
+   └──────────────────────────────────────────────────────────────────┘ */
+signal on syntax;  signal on novalue   /*handle REXX program errors.    */
+signal on halt                         /*handle cell growth interruptus.*/
+parse arg peeps '(' generations rows cols bare! life! clearscreen every
+@abc='abcdefghijklmnopqrstuvwxyz'; @abcU=@abc; upper @abcU
+      blank = 'BLANK'
+generations = p(generations            100)
+       rows = p(rows                   3)
+       cols = p(cols                   3)
+      bare! = pickchar(bare!           blank)
+clearscreen = p(clearscreen            0)
+      every = p(every                  999999999)
+      life! = pickchar(life!           '☼')
+fents=max(79,cols)                     /*fence width shown after display*/
+$.=bare!                               /*the universe is new, and barren*/
+gens=abs(generations)                  /*use this for convenience.      */
+x=space(peeps)                         /*remove superfluous spaces.     */
+if x=='' then x='2,1 2,2 2,3'
+
+        do  while x \==''
+        parse var x p x; parse var p r ',' c .; $.r=overlay(life!,$.r,c+1)
+        end
+life=0;     !.=0;    call showCells    /*show initial state of the cells*/
+/*─────────────────────────────────────watch cell colony grow/live/die. */
+  do  life=1 for gens
+    do   r=1 for rows;     rank=bare!
+      do c=2 for cols;     ?=substr($.r,c,1);       ??=?;    n=neighbors()
+          select                       /*select da quickest choice first*/
+          when ?==bare!    then  if n==3       then ??=life!
+          otherwise              if n<2 | n>3  then ??=bare!
+          end   /*select*/
+      rank=rank || ??
+      end       /*c*/
+    @.r=rank
+    end         /*c*/
+
+       do r=1 for rows; $.r=@.r; end   /*assign alternate cells ──► real*/
+  if life//every==0 | generations>0 | life==gens then call showCells
+  end           /*life*/
+/*─────────────────────────────────────stop watching the universe (life)*/
+halt: cycles=life-1; if cycles\==gens then say 'REXX program interrupted.'
+exit                                   /*stick a fork in it, we're done.*/
+/*───────────────────────────────SHOWCELLS subroutine─-─────────────────*/
+showCells: if clearscreen then 'CLS'   /*  ◄─── change this for your OS.*/
+_=;   do r=rows  by -1  for rows       /*show the forest in proper order*/
+      z=strip(substr($.r,2),'T')       /*pick off the meat of the row.  */
+      say z;   _=_ || z                /*be neat about trailing blanks. */
+      end   /*r*/
+say right(copies('═',fents)life,fents) /*show&tell for a stand of trees.*/
+if _=='' then exit                     /*if no life, then stop the run. */
+if !._   then do;   say 'repeating ...';    exit;   end
+!._=1                                  /*assign a state & compare later.*/
+return
+/*───────────────────────────────NEIGHBORS subroutine───────────────────*/
+neighbors: rp=r+1; cp=c+1; rm=r-1; cm=c-1  /*count 8 neighbors of a cell*/
+return    (substr($.rm,cm,1)==life!)   +   (substr($.rm,c ,1)==life!)  + ,
+          (substr($.rm,cp,1)==life!)   +   (substr($.r ,cm,1)==life!)  + ,
+          (substr($.r ,cp,1)==life!)   +   (substr($.rp,cm,1)==life!)  + ,
+          (substr($.rp,c ,1)==life!)   +   (substr($.rp,cp,1)==life!)
+/*───────────────────────────────1-liner subroutines────────────────────*/
+err:      say;say;say center(' error! ',max(40,linesize()%2),"*");say;do j=1 for arg();say arg(j);say;end;say;exit 13
+novalue:  syntax: call err 'REXX program' condition('C') "error",condition('D'),'REXX source statement (line' sigl"):",sourceline(sigl)
+pickchar: _=p(arg(1));if translate(_)==blank then _=' ';if length(_) ==3 then _=d2c(_);if length(_) ==2 then _=x2c(_);return _
+p:        return word(arg(1),1)
diff --git a/Task/Forest_fire/Racket/forest_fire.rkt b/Task/Forest_fire/Racket/forest_fire.rkt
new file mode 100644
index 0000000000..2677e5f5a0
--- /dev/null
+++ b/Task/Forest_fire/Racket/forest_fire.rkt
@@ -0,0 +1,60 @@
+#lang racket
+(require 2htdp/universe)
+(require 2htdp/image)
+
+(define (initial-forest w p-tree)
+  (for/vector #:length w ((rw w))
+    (for/vector #:length w ((cl w))
+      (if (< (random) p-tree) #\T #\_))))
+
+(define (has-burning-neighbour? forest r# c# w)
+  ;; note, this will check r# c#, too but it's not
+  ;; worth checking that r=r# and c=c# each time in
+  ;; this case
+  (for*/first
+      ((r (in-range (- r# 1) (+ r# 2)))
+       #:when (< 0 r w)
+       (c (in-range (- c# 1) (+ c# 2)))
+       #:when (< 0 c w)
+       #:when (equal? #\* (vector-ref (vector-ref forest r) c)))
+    #t))
+
+(define (fire-tick forest p-sprout f-combust w)
+  (for/vector #:length w ((rw forest) (r# (in-naturals)))
+    (for/vector #:length w ((cl rw) (c# (in-naturals)))
+      (case cl
+        ((#\_) (if (< (random) p-sprout) #\T #\_))
+        ((#\*) #\_)
+        ((#\T)
+         (cond
+           [(has-burning-neighbour? forest r# c# w) #\*]
+           [(< (random) f-combust) #\*]
+           [else #\T]))))))
+
+(define (render-forest state)
+  (for/fold
+      ((scn (empty-scene
+             (* (vector-length state) 8)
+             (* (vector-length (vector-ref state 0)) 8)
+             'black)))
+
+    ((rw state) (r# (in-naturals)))
+    (for/fold
+        ((scn scn))
+      ((cl rw) (c# (in-naturals)))
+      (place-image (circle 4 'solid
+                           (case cl
+                             ((#\_) 'brown)
+                             ((#\T) 'green)
+                             ((#\*) 'red)))
+                   (+ 4 (* c# 8)) (+ 4 (* r# 8)) scn))))
+
+(define (forest-fire p-tree p-sprout f-combust w)
+  (big-bang
+   (initial-forest w p-tree) ;; initial state
+   [on-tick (lambda (state)
+              ;(displayln state)
+              (fire-tick state p-sprout f-combust w))]
+   [to-draw render-forest]))
+
+(forest-fire 0 1/8 1/1024 50)
diff --git a/Task/Forest_fire/Ruby/forest_fire.rb b/Task/Forest_fire/Ruby/forest_fire.rb
new file mode 100644
index 0000000000..bbb8134de3
--- /dev/null
+++ b/Task/Forest_fire/Ruby/forest_fire.rb
@@ -0,0 +1,60 @@
+require 'enumerator'
+
+def transition arr, tree_prob, fire_prob
+  arr.enum_with_index.map do |cell, i|
+    if i == 0 or i == arr.length - 1
+      # boundary conditions: cells are always empty here
+      :empty
+    else
+      case cell
+      when :fire
+        # burning cells become empty
+        :empty
+      when :empty
+        # empty cells grow a tree with probability tree_prob
+        rand < tree_prob ? :tree : :empty
+      when :tree
+        # check my neighbouring cells, are they on fire?
+        if arr[i - 1] == :fire or arr[i + 1] == :fire
+          :fire
+        else
+          # neighbours not on fire, but catch fire at random
+          rand < fire_prob ? :fire : :tree
+        end
+      end
+    end
+  end
+end
+
+def pretty_print arr
+  # colour the trees green, the fires red, and the empty spaces black
+  print(arr.map { |cell|
+    "\e[3" +
+      case cell
+      when :tree
+        "2mT"
+      when :fire
+        "1mF"
+      when :empty
+        "0m "
+      end + "\e[0m"
+  }.join)
+end
+
+N = 20    # 20 trees
+P = 0.5   # probability of growing a tree
+F = 0.1   # probability of catching on fire
+
+srand Time.now.to_i
+
+# each cell has a 50/50 chance of being a tree
+array = (1..N).map { rand < 0.5 ? :tree : :empty }
+array[0] = array[-1] = :empty  # boundary conditions
+pretty_print array
+puts
+
+begin
+  array = transition(array, P, F)
+
+  pretty_print array
+end while gets.chomp.downcase != "q"
diff --git a/Task/Forest_fire/Sather/forest_fire.sa b/Task/Forest_fire/Sather/forest_fire.sa
new file mode 100644
index 0000000000..d64317e39e
--- /dev/null
+++ b/Task/Forest_fire/Sather/forest_fire.sa
@@ -0,0 +1,196 @@
+class FORESTFIRE is
+  private attr fields:ARRAY{ARRAY{INT}};
+  private attr swapu:INT;
+  private attr rnd:RND;
+  private attr verbose:BOOL;
+  private attr generation:INT;
+  readonly attr width, height:INT;
+  const empty:INT := 0;
+  const tree:INT := 1;
+  const burning:INT := 2;
+
+  attr prob_tree, prob_p, prob_f :FLT;
+
+  create(w, h:INT, v:BOOL):SAME is
+    res:FORESTFIRE := new;
+    res.fields := #(2);
+    res.fields[0] := #(w*h);
+    res.fields[1] := #(w*h);
+    res.width := w; res.height := h;
+    res.swapu := 0;
+    res.prob_tree := 0.55;
+    res.prob_p := 0.001;
+    res.prob_f := 0.00001;
+    res.rnd := #RND;
+    res.verbose := v;
+    res.generation := 0;
+    res.initfield;
+    return res;
+  end;
+
+  -- to give variability
+  seed(i:INT) is
+    rnd.seed(i);
+  end;
+
+  create(w, h:INT):SAME is
+    res ::= create(w, h, false);
+    return res;
+  end;
+
+  initfield is
+    n ::= 0;
+    swapu := 0;
+    if verbose and generation > 0 then
+      #ERR + "Previous generation " + generation + "\n";
+    end;
+    generation := 0;
+    loop i ::= 0.upto!(width-1);
+      loop j ::= 0.upto!(height-1);
+        if rnd.uniform > prob_tree.fltd then
+          cset(i, j, empty);
+        else
+	  n := n + 1;
+          cset(i, j, tree);
+        end;
+      end;
+    end;
+    if verbose then
+      #ERR + #FMT("Field size is %dx%d (%d)", width, height, size) + "\n";
+      #ERR + "There are " + n + " trees (" + (100.0*n.flt/size.flt) + "%)\n";
+      #ERR + "prob_tree = " + prob_tree + "\n";
+      #ERR + "prob_f = " + prob_f + "\n";
+      #ERR + "prob_p = " + prob_p + "\n";
+      #ERR + "ratio = " + prob_p/prob_f + "\n";
+    end;
+  end;
+
+  field:ARRAY{INT} is
+    return fields[swapu];
+  end;
+
+  ofield:ARRAY{INT} is
+    return fields[swapu.bxor(1)];
+  end;
+
+  size:INT is
+    return width*height;
+  end;
+
+  set(i, j, t:INT)
+    pre bcheck(i, j)
+  is
+    ofield[j*width + i] := t;
+  end;
+
+  cset(i, j, t:INT)
+    pre bcheck(i, j)
+  is
+    field[j*width + i] := t;
+  end;
+
+  private bcheck(i, j:INT):BOOL is
+    if i.is_between(0, width-1) and j.is_between(0, height-1) then
+      return true; -- is inside
+    else
+      return false; -- is outside
+    end;
+  end;
+
+  get(i, j:INT):INT is
+    if ~bcheck(i, j) then
+      return empty;
+    end;
+    return field[j*width + i];
+  end;
+
+  oget(i, j:INT):INT is
+    if ~bcheck(i, j) then
+      return empty;
+    end;
+    return ofield[j*width + i];
+  end;
+
+  burning_neighbor(i, j:INT):BOOL is
+    loop x ::= (-1).upto!(1);
+      loop y ::= (-1).upto!(1);
+        if x /= y then
+          if get(i+x, j+y) = burning then return true; end;
+        end;
+      end;
+    end;
+    return false;
+  end;
+
+  evolve is
+    bp ::= 0;
+    loop i ::= 0.upto!(width-1);
+      loop j ::= 0.upto!(height-1);
+	case get(i, j)
+        when burning then set(i, j, empty); bp := bp + 1;
+        when empty then
+          if rnd.uniform > prob_p.fltd then
+            set(i, j, empty);
+          else
+            set(i, j, tree);
+          end;
+        when tree then
+          if burning_neighbor(i, j) then
+            set(i, j, burning);
+          else
+            if rnd.uniform > prob_f.fltd then
+              set(i, j, tree);
+            else
+              set(i, j, burning);
+            end;
+          end;
+        else
+          #ERR + "corrupted field\n";
+        end;
+      end;
+    end;
+    generation := generation + 1;
+    if verbose then
+      if bp > 0 then
+        #ERR + #FMT("Burning at gen %d: %d\n", generation-1, bp);
+      end;
+    end;
+    swapu := swapu.bxor(1);
+  end;
+
+  str:STR is
+    s ::= "";
+    loop j ::= 0.upto!(height -1);
+      loop i ::= 0.upto!(width -1);
+        case get(i, j)
+          when empty then s := s + ".";
+          when tree then s := s + "Y";
+          when burning then s := s + "*";
+        end;
+      end;
+      s := s + "\n";
+    end;
+    s := s + "\n";
+    return s;
+  end;
+
+end;
+
+class MAIN is
+
+  main is
+    forestfire ::= #FORESTFIRE(74, 40);
+    -- #FORESTFIRE(74, 40, true) to have some extra info
+    -- (redirecting stderr to a file is a good idea!)
+
+    #OUT + forestfire.str;
+    -- evolve 1000 times
+    loop i ::= 1000.times!;
+      forestfire.evolve;
+      -- ANSI clear screen sequence
+      #OUT + 0x1b.char + "[H" + 0x1b.char + "[2J";
+      #OUT + forestfire.str;
+    end;
+  end;
+
+end;
diff --git a/Task/Forest_fire/Scala/forest_fire-2.scala b/Task/Forest_fire/Scala/forest_fire-2.scala
new file mode 100644
index 0000000000..fd2a25f4ef
--- /dev/null
+++ b/Task/Forest_fire/Scala/forest_fire-2.scala
@@ -0,0 +1,9 @@
+object ForestFire{
+  def main(args: Array[String]): Unit = {
+    var l=Forest()
+    for(i <- 0 until 20){
+      println(l+"\n-----------------------")
+      l=l.evolve
+    }
+  }
+}
diff --git a/Task/Forest_fire/Scala/forest_fire.scala b/Task/Forest_fire/Scala/forest_fire.scala
new file mode 100644
index 0000000000..4b6a9b5cb4
--- /dev/null
+++ b/Task/Forest_fire/Scala/forest_fire.scala
@@ -0,0 +1,28 @@
+import scala.util.Random
+
+class Forest(matrix:Array[Array[Char]]){
+  import Forest._
+  val f=0.01;	 // auto combustion probability
+  val p=0.1;	 // tree creation probability
+  val rows=matrix.size
+  val cols=matrix(0).size
+
+  def evolve():Forest=new Forest(Array.tabulate(rows, cols){(y,x)=>
+    matrix(y)(x) match {
+      case EMPTY => if (Random.nextDouble EMPTY
+      case TREE => if (neighbours(x, y).exists(_==BURNING)) BURNING
+                  else if (Random.nextDouble if (Random.nextDouble<0.5) TREE else EMPTY))
+}
diff --git a/Task/Forest_fire/Tcl/forest_fire.tcl b/Task/Forest_fire/Tcl/forest_fire.tcl
new file mode 100644
index 0000000000..d1f34d3dc6
--- /dev/null
+++ b/Task/Forest_fire/Tcl/forest_fire.tcl
@@ -0,0 +1,78 @@
+package require Tcl 8.5
+
+# Build a grid
+proc makeGrid {w h {treeProbability 0.5}} {
+    global grid gridW gridH
+    set gridW $w
+    set gridH $h
+    set grid [lrepeat $h [lrepeat $w " "]]
+    for {set x 0} {$x < $w} {incr x} {
+	for {set y 0} {$y < $h} {incr y} {
+	    if {rand() < $treeProbability} {
+		lset grid $y $x "#"
+	    }
+	}
+    }
+}
+
+# Evolve the grid (builds a copy, then overwrites)
+proc evolveGrid {{fireProbability 0.01} {plantProbability 0.05}} {
+    global grid gridW gridH
+    set newGrid {}
+    for {set y 0} {$y < $gridH} {incr y} {
+	set row {}
+	for {set x 0} {$x < $gridW} {incr x} {
+	    switch -exact -- [set s [lindex $grid $y $x]] {
+		" " {
+		    if {rand() < $plantProbability} {
+			set s "#"
+		    }
+		}
+		"#" {
+		    if {[burningNeighbour? $x $y] || rand() < $fireProbability} {
+			set s "o"
+		    }
+		}
+		"o" {
+		    set s " "
+		}
+	    }
+	    lappend row $s
+	}
+	lappend newGrid $row
+    }
+    set grid $newGrid
+}
+
+# We supply the neighbourhood model as an optional parameter (not used...)
+proc burningNeighbour? {
+    x y
+    {neighbourhoodModel {-1 -1  -1 0  -1 1  0 -1  0 1  1 -1  1 0  1 1}}
+} {
+    global grid gridW gridH
+    foreach {dx dy} $neighbourhoodModel {
+	set i [expr {$x + $dx}]
+	if {$i < 0 || $i >= $gridW} continue
+	set j [expr {$y + $dy}]
+	if {$j < 0 || $j >= $gridH} continue
+	if {[lindex $grid $j $i] eq "o"} {
+	    return 1
+	}
+    }
+    return 0
+}
+
+proc printGrid {} {
+    global grid
+    foreach row $grid {
+	puts [join $row ""]
+    }
+}
+
+# Simple main loop; press Return for the next step or send an EOF to stop
+makeGrid 70 8
+while 1 {
+    evolveGrid
+    printGrid
+    if {[gets stdin line] < 0} break
+}